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

Re: fetchmail question (newbie) ... SOLVED



Christopher Splinter wrote:
> 
> * Viktor Rosenfeld <rosenfel@informatik.hu-berlin.de> writes:
> 
> > So I thought of placing a script with `fetchmail -d 300` into
> > the /etc/ppp/ip-up.d directory and a script with `fetchmail -q`
> > into the /etc/ppp/ip-down.d directory.  The problem is that
> > those scripts are executed as root,
> 
> su - -c "fetchmail -d 300" <username>

I went inline skating and came up with the same idea.  Here are the
scripts I came up with, if anybody has the same problem ...

---8< cut: /etc/ppp/ip-up.d/fetchmail >8---
#!/bin/sh
 
USERDB="/etc/fetchmail.users"
OPTIONS="--daemon 300 --syslog"
 
# Start fetchmail for each user listed in $USERDB
if [ -e $USERDB ] && [ -e `which fetchmail` ]; then
    for username in `cat $USERDB | grep -v \#`; do
        su -c "fetchmail $OPTIONS" $username 2> /dev/null
    done
fi                                                                              

---8< cut: /etc/ppp/ip-down.d/fetchmail >8---
#!/bin/sh
 
USERDB="/etc/fetchmail.users"
 
# Terminate fetchmail for each user in $USERDB
if [ -e $USERDB ] && [ -e `which fetchmail` ]; then
    for username in `cat $USERDB | grep -v \#`; do
        su -c "fetchmail -q" $username 2> /dev/null
    done
fi

/etc/fetchmail.users is a list of user names that want to have their
mail fetched.  They need to have a .fetchmailrc file, in which they can
specify the servers.  The grep stuff gets rid of comments in the
database file.

This does exactly what I wanted it to.  Now I only have to set up Mutt,
and GnuPG, and Exim, and procmail up and then I can finally get rid of
that Netscape. :)

Thanks all,
Viktor                                                                           
-- 
Viktor Rosenfeld
E-Mail:		mailto:rosenfel@informatik.hu-berlin.de
HertzSCHLAG:	http://www.informatik.hu-berlin.de/~rosenfel/hs/



Reply to: