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

Re: Fetchmail + cron + dialup



Incoming from Kevin Mark:
> On Thu, Sep 30, 2004 at 12:57:00PM +0200, Robert Golovniov wrote:
> > 
> > What is the best way to configure fetchmail to regularly check for new 
> > mail on a dialup account? I tried doing it with a simple cron job like 
> 
> I have a small script that checks the machine in online before it runs
> fetchmail. So the cron jobs runs constantly but fechmail only runs when
> on line.
>  #-------------------------------------------------------------------
>  IP=$(/sbin/ifconfig ppp0 2>&1 |grep inet|cut -f2 -d:|cut -d' ' -f1)
>  if [ $IP ]; then
>  	# online
> 	fetchmail
>  fi

Alternatively:

  # -------------------------
  modem=ttyS0
  if [ ! -f ~/.fetchmail.pid ]; then
     if [ -f /var/lock/LCK..${modem} -a "$(ifconfig | grep ppp0)" ]; then
        nice /usr/bin/fetchmail > /dev/null 2>&1
        ...
     fi
  fi
  # -------------------------

At times, there's lots of mail coming in, and it may take longer then
to get it all than the cycle length you'd ordinarily use, so it's best
to see if fetchmail is already running.


-- 
Any technology distinguishable from magic is insufficiently advanced.
(*)               http://www.spots.ab.ca/~keeling 
- -



Reply to: