I wrote this little script in Perl and run it via cron every 5 minutes. It
appears to work so far.... I can't just do a network restart because that
doesn't always fix the problem (who knows why). Since this server is only
useful if the network is working it seems that rebooting it is a decent
solution if that fixes the network. I'd appreciate any comments about the
script.
#!/usr/bin/perl
#check eth0 existence
$neton = `/sbin/ifconfig`;
#ping some hosts on the Internet
$ping = `ping -c 3 134.53.7.13`;
$ping2 = `ping -c 3 206.222.218.232`;
$ping3 = `ping -c 3 64.0.106.74`;
if ($ping =~ (/100% packet loss/i) && $ping2 =~ (/100% packet loss/i) &&
$ping3 =~ (/100% packet loss/i)){
#The ping has failed
exec("/sbin/shutdown -r now")
}
if ($neton !~ (/eth0/i)){
#The Network is Unreachable
exec("/sbin/shutdown -r now")
}
-Ryan
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of David Talkington
Sent: Monday, April 30, 2001 2:12 PM
To: [EMAIL PROTECTED]
Subject: Re: Keeping a remote server online
-----BEGIN PGP SIGNED MESSAGE-----
Ryan Dlugosz wrote:
>Perhaps there is a package that will monitor the Internet connectivity
>somehow and automatically reboot if there is none?
Be creative, my son. Unix gives you all the tools you need. You
don' need no stinking packages. =)
How about a little shell script that does a ping every couple of
minutes, and if it fails, does /etc/init.d/network restart?
- -d
- --
David Talkington
http://www.spotnet.org
PGP key: http://www.prairienet.org/~dtalk/dt000823.asc
-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8
Comment: Made with pgp4pine 1.75-6
iQEVAwUBOu2rDb1ZYOtSwT+tAQF7Owf/SJ7r1e2K0gPcZh1peJKCjEp8vef4/yXp
meA7TmqYfUijpubLMf3KnCfo9+buJMjAVJFWwmBCclR0uWBue0PoERP9noBJBDQ+
qEKA5M+kjNp+CNsb/edke+GGXrr2n4UWlBL2OsVXi0iMKBsr7EyvsIqP46mDVMnu
MkKGgxR/7C6MMlubzhyaWBZX5Sd3fc7RaK/0dMLLoFqiJPXUrLyssvOAfL3umKHb
ip9IBLHZFl0rZhWPKMtgoYLaw+Jf5nRI+kA/n+VORNYHHFm92lXsRjJpE0eNa2WG
gNFO74CBcwJjX3ha/Lq8owxAkl9TW9je732KJdfmIIEifvGnqlIPiw==
=0iiN
-----END PGP SIGNATURE-----
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list