[EMAIL PROTECTED] wrote:
>
> does anyone know of a program or script that will periodically poll my ISP so
> that it doesn't disconnect when it thinks the connection is idle?
Along the lines of some of the other reponses, I've a script I wrote that
gets called from my ~/.bashrc andfrom my ~/.bash_logout When I log in, the
script checks to see if fetchmail is running. If it is, the script exits.
If not, it starts fetchmail in daemon mode. At logout, the script looks to
see how many times I'm logged in. If this is the last instance of me being
logged in, then the script kills fetchmail. Here's the script:
----- begin fetchmail.sh -----
#! /bin/bash
LOGCOUNT=`w -hsf|grep mike|wc -l`
MAXCOUNT=1
case "$1" in
start-daemon)
if [ -e ~mike/.fetchmail.pid ]
then
exit
fi
fetchmail -d 120
;;
start)
if [ -e ~mike/.fetchmail.pid ]
then
exit
fi
fetchmail
;;
stop-daemon)
if [ ! -e ~mike/.fetchmail.pid ]
then
exit
fi
if [ $LOGCOUNT -eq $MAXCOUNT ]
then
fetchmail --quit
fi
;;
esac
exit 0
----- end fetchmail.sh -----
In the ~/.bashrc is the line:
/home/mike/fetchmail.sh start-daemon
and in the ~/.bash_logout is the line
/home/mike/fetchmail.sh stop-daemon
It's not perfect, but it does work. Eventually I'm going to go back through
and clean it up a bit more, things like make the username read from the
system and not hardcoded. Also need to make it work right when the login
was via su.
Something else that bears mention here - part of why this works well for me
is that I'm connected to the 'net via a demand-dialing router. So as far as
my box knows it's got a full-time direct connection to the 'net.
--
Mike Werner KA8YSD | He that is slow to believe anything and
| everything is of great understanding,
'91 GS500E | for belief in one false principle is the
Morgantown WV | beginning of all unwisdom.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs