[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: fetchmail für alle Benutzer?



Am 2003-11-10 13:23:07, schrieb Peter Blancke:
>Steffen Hey <steff.hey@lycos.de> dixit:
>
>> Ist mein Vorhaben alle fetchmailrc in den home-Verzeichnissen
>> abzuarbeiten mit fetchmail lösbar?
>
>Ja. Probier das sinngemaess mal so (ungetestet!):
>
>,---
>| find /home -type f -name .fetchmailrc -exec fetchmail -f {} \;
>`---

Hallo Peter, 

Das funktioniert nicht so einfach...
Da landen alle Mails in /var/mail/root !!!

Und wenn Du 'mda /usr/bin/procmail' verwendest, gehts auch nicht, denn 
er weis nicht, als welcher $USER er arbeiten soll...

Das geht nur mit /etc/fetchmailrc

mda "/var/mail/procmail -d %T"

Naja, ich habe das folgendermaßen gelößt:

------------------------------------------------------------------------
#/etc/fetchmailrc.tmp
set syslog
set logfile	/var/log/fetchmail.log
set no bouncemail
set postmaster	michelle
set invisible
defaults:
    antispam	   -1 
    batchlimit	   10
    warnings	  300
    fetchall
    expunge	   10
    mda		"/usr/bin/procmail -d %T"
    dropstatus
------------------------------------------------------------------------
und dann das script per cron aufgerufen:

------------------------------------------------------------------------
#!/bin/bash
DATUM=`date +%Y-%m-%d`
# Write Logfile to "Admins" directory
echo "Processing: "`date +%Y-%m-%d`" "`date +%H:%M:%S` >> /home/michelle/.root/fetchmail-$DATUM.acc
# ping to let ppp Dialout-On-Demand to avoid errors with fetchmail
ping -c 1 www.microsoft.com
ping -c 1 www.microsoft.com
ping -c 1 www.microsoft.com
if [ $? == 0 ] ; then
for i in `ls -d /home/*/.fetchmailrc` ; do
    # Copy temporarly to "Global" /etc/fetchmailrc
    cat /etc/fetchmailrc.temp >/etc/fetchmailrc
    # Write logfile
    echo -n `date +%Y-%m-%d`	>>/home/michelle/.root/fetchmail-$DATUM.acc
    echo -n " "`date +%H:%M:%S`	>>/home/michelle/.root/fetchmail-$DATUM.acc
    TEMPO1=`dirname $i`
    TEMPO2=`basename $TEMPO1`
    echo    " : "$TEMPO2	>>/home/michelle/.root/fetchmail-$DATUM.acc
    # Append users ".fetchmailrc" to the "Global" /etc/fetchmailrc
    cat $i >>/etc/fetchmailrc
    # Change permission because fetchmail need it
    chmod 600 /etc/fetchmailrc
    # Download messages
    /usr/bin/fetchmail --fetchmailrc /etc/fetchmailrc
    # remove fetchmailrc
    rm -f /etc/fetchmailrc
done
# Write again logfiles
cat /var/log/syslog |grep "Unknown login"      > /home/michelle/.root/fetchmail-`date +%Y-%m-%d`.err
cat /var/log/syslog |grep "message\(s\)\? for" > /home/michelle/.root/fetchmail-`date +%Y-%m-%d`.new
chown michelle.michelle /home/michelle/.root/*
chmod 600 /home/michelle/.root/*
else
    # Write Error to logfile if Telephoneline is broken or somthing else
    echo -n "Processing: failed. No Network at  " >> /home/michelle/.root/fetchmail-$DATUM.acc
    echo    `date +%Y-%m-%d`" "`date +%H:%M:%S`    >> /home/michelle/.root/fetchmail-$DATUM.acc
fi
------------------------------------------------------------------------

Also das funktioniert einwandfrei... und wird von mir 2 mal pro Tag 
aufgerufen... 7:10 und 23:10 damit ich noch im Billig-Tarif downloade. 

Arbeite allerdings an einem neuen Script, das die ~/.fetchmailrc 
unverändert übernimmt, aber an den Eintrag 'mda /usr/bin/procmail'  
noch ein '-d %T' dranhängt.

Grüße
Michelle

-- 
Registered Linux-User #280138 with the Linux Counter, http://counter.li.org.



Reply to: