TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dial on demand (ppp) and knowing it



I have pppd setup for demand dialing, and since fetchmail seems to quit on
errors in daemon mode and not try again I'm taking someone's suggestion
from the list and running fetchmail in cron every 5 minutes. The thing is
I don't want to check for e-mail if I'm not already online.

I'd like to have a script that checks if I'm online and only if so, checks
mail. Then run this script every minutes.

My first idea was to do 

#!/bin/sh
status=`cat /status`
if [ $status == "on" ]
then
fetchmail -f /etc/fetchmail
fi

and have /etc/ppp/ip-up.local echo on to /status and off to /status when
it connects and disconnects. This works fine, except that for some reason
every month of so pppd decides to stop runing /etc/ppp/ip-up.local when it
connects and so that could cause fetchmail to either never run or to
trigger a dialup every five minutes. Is there a better way to see if I'm
online (I can't to a process check since pppd is loaded with offline)

Thanks,

Ben