[Esd-l] Script file
Steve Sykes
ssykes at emirates.net.ae
Sun Jun 30 10:20:01 PDT 2002
This may not be the place to ask this but I thought as it is to do with
mail I might try. I have been attempting to get this script to work but
I haven't had much luck.
Al I am looking to do is have the link come up, fetchmail and send the
queue and drop the link. This script sees when the ppp0 is active but I
don't think it waits until the addresses have been sent to fetchmail
can't find the server. Is there a better way to loop until the link is
finished connecting?
Regards,
Steve Sykes
#!/bin/bash
DEVICE=ppp0
# login script
/usr/sbin/pppd /dev/ttyS0 57600 connect "/usr/sbin/chat -f
$HOME/.chatscript"
while [ ! -e /var/run/$DEVICE.pid ]; do
wait
done
echo "Link is UP"
#
#
# When link is up, do mail
if [ -e /var/run/$DEVICE.pid ]; then
echo "PPP is UP, starting the mail transfer"
/usr/bin/fetchmail -v -f /home/mailbox/.fetchmailrc
/usr/sbin/sendmail -q
echo "Done, Goodbye"
kill -INT `cat /var/run/$DEVICE.pid`
#
# get rid of a lock file if there.
if [ ! "$?" = "0" ]; then
rm -f /var/run/$DEVICE.pid
echo "ERROR: removed stale pid file"
exit 1
fi
# pppd closes.
echo "PPP link to $DEVICE terminated."
exit 0
fi
#
# The ppp process is not running for ppp0
echo "ERROR: PPP link is not active on $DEVICE"
exit 1
More information about the esd-l
mailing list