Keepalive script, modified. Maybe someone can take a look and see if there
are any obvious bugs. Thanks,
#!/bin/sh
# keepalive script by Irwin Kwan 2003
# Argument Order:
# first arg: INTERFACE to bring up or down
# second arg: TARGETHOST that you ping for connectivity
#
if [ -z $1 ]; then
INTERFACE=ppp0
else
INTERFACE=$1
fi;
if [ -z $2 ]; then
TARGETHOST=64.39.160.16
else
TARGETHOST=$2
fi;
COUNT=10
# If the DSL connection is up, keep it alive with ping.
if [ ! -z "`ip link | grep $INTERFACE`" ]; then
# Ping the target host. If the network is down, then
# bring down the interface and bring it back up
while [ ! -z `ping -c $COUNT $TARGETHOST | grep '100% packet
loss|Network is unreachable'` ]; do
down_and_up
sleep 10
done;
else
# There is no ppp0 in the list of links, so bring it down
# and bring it back up
down_and_up
fi;
down_and_up()
{
ifdown $INTERFACE 2&>1 /dev/null
ifup $INTERFACE 2&>1 /dev/null
}
--
-- Arcana
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
------------------------------------------------------------------------
leaf-user mailing list: [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user
SR FAQ: http://leaf-project.org/pub/doc/docmanager/docid_1891.html