[EMAIL PROTECTED] wrote:
> I get my mail several times a day using crontab to dial in
> I need to terminate the connection when there is no more activity
> on the ppp link sometimes it is 3 Min sometimes it is 30 Min.

You can run ppp-off as soon as fetchmail is done. Here's one way to do it:

#!/bin/sh
/usr/sbin/usernetctl ppp0 up
sleep 60
defroute=`/sbin/route -n | /bin/grep -c ^0.0.0.0`
if [ "$defroute" = "1" ] ; then
        /usr/bin/fetchmail
else
        echo "Connection failed."
fi
/usr/sbin/usernetctl ppp0 down


The script depends on your connection script setting a default route when
the connection is up. If you have a default route even when you're not
connected, then you'll have to figure out a different way to test the
connection.

Tony
-- 
 Anthony E. Greene <[EMAIL PROTECTED]>
 Homepage & PGP Key <http://www.pobox.com/~agreene/>
 If it's too good to be true, it's probably Linux.


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to