BigNoseBird.Com- home Small Logo
The 508 compliant Guide to 
       Big Nose Bird
RETURN TO THE NOTEBOOK INDEX

 
Network Services Reboot Script for Network Cards using the Tulip Driver

Some of my servers use the Netgear 310TX card (which is approved by Redhat btw), and have a sort of nasty habit. It seems that whenever they get unplugged from the network, the card (or OS) doesn't then detect that the card is reconnected and so the link remains dead.

Needless to say, this can render a remote box rather useless and force a call to the webhotel folks for the "... yes, I know it's Linux, and it never needs a reboot, but..." call!

I found this little script called from cron seems to take care of the problem of never being able to get the server responding.

You can of course adjust the cron interval to suit your needs. Be sure to set your $GWADDR to your gateway address.

If your gateway address changes- don't forget to change it in the script or you will get bounced very X number of minutes. ;-)

#------------SCRIPT-STARTS-UNDER-THIS-LINE-----------#
#!/usr/bin/perl

#netboot: tests to see if gateway is unreachable and
#if so, restart networking. Useful for tulip based
#cards. Call from crontab
#set $GWADDR to your gateway address. 

$GWADDR="192.192.192.192";

$result=`/bin/ping -c 2 -w 3 $GWADDR 2>/dev/null`;
chop $result;
$reslen=length($result);
if ($reslen < 10 || $result=~/100\% packet loss/i){
 system("/etc/init.d/network restart");
}

#------------SCRIPT-ENDS-HERE------------------------#

#----------------- put this line in /etc/crontab
#0,10,20,30,40,50 * * * * root /path_to/netboot





Find or Give Help on the BBS
 
Home Top E-Mail
If it looks great, it's by Christine
Some Fine Print
© 1997-2003 BigNoseBird.Com®, Inc. All rights reserved. All other trademarks are the sole property of their respective owners. The products that we recommend are only ones that we use. We have no relationship with any of the authors or their companies. We cannot assume responsibility for their ultimate performance or lack of same. We also cannot assume responsibility for either any programs provided here, or for any advice that is given since we have no control over what happens after our code or words leave this site. Always use prudent judgment in implementing any program- and always make a backup first! For further information, please read our Privacy Statement. We can be contacted at webmaster@bignosebird.com.


<reallybig.com>
Web Builder Network Portal
Advertise
on the
Reallybig.com
Network
BigNoseBird Newsletter
Subscribe
Un-Subscribe


Sign up today to receive our low volume newsletter. Tips, tricks, news, and whatever else crosses our minds.
Back Issues
Privacy Statement