[oclug] Auto ifdown / ifup
Jonathan Earle
jearle at nortelnetworks.com
Thu Feb 1 11:29:51 EST 2001
> Is there a way to either:
> -constantly ping the internet, and if it is down, to run a
> combination
> ifdown / ifup script, when the connection is restored,
You could schedule a cron job to run every 5mins or so, which calls the
following script:
#!/bin/sh
host=<your gateway IP>
eth=eth0
if ! ping -c 1 $host > /dev/null; then
# Can't reach gateway, assume link is dead and reset.
/sbin/ifdown $eth
/sbin/ifup $eth
else
# We're good to go.
fi
More information about the OCLUG
mailing list