hi erich your version has the advantage that the hosts are rotated, so i can poll much faster. initially i just wanted to ping one host and keep the others as a reserve in case the first went offline. however this delays recovery, as the following log shows: 8 minutes before network was up again.
so this brings up the next question, which is how to find reasonable delays before restarting the network and waiting for the network to go up before restarting it again. thanks to all, kiril [root@bay network]# cat current | tai64nlocal 2002-05-28 18:59:03.520783500 starting connection monitor... 2002-05-30 15:15:34.888502500 www.bol.de is down, trying next host... 2002-05-30 15:17:34.918443500 www.db24.de is down, trying next host... 2002-05-30 15:19:34.948508500 www.redhat.com is down, trying next host... 2002-05-30 15:21:34.978430500 www.linux.org is down, trying next host... 2002-05-30 15:23:35.008522500 www.ibiblio.org is down, trying next host... 2002-05-30 15:23:35.029444500 network is down. restarting... 2002-05-30 15:23:36.652992500 Setting network parameters: [ OK ] 2002-05-30 15:23:36.851080500 Bringing up interface lo: [ OK ] 2002-05-30 15:23:37.756420500 Bringing up interface eth0: [ OK ] 2002-05-30 15:24:43.112993500 starting connection monitor... -----Ursprüngliche Nachricht----- Von: Erich Titl <[EMAIL PROTECTED]> An: [EMAIL PROTECTED] <[EMAIL PROTECTED]> Datum: Mittwoch, 29. Mai 2002 15:41 Betreff: Re: [leaf-user] Detecting Disconnected Network Hi Kiril If I read your script correctly then there might be a little glitch At 18:49 28.05.2002 -0700, you wrote: >my last version of the script for pinging hosts follows. if there is a more >elegant and reliable way to react in such rare situations, i will be glad to >hear it. > >regards, > >kiril > > > >#!bin/bash >PING_REMOTE_HOSTS="host1.com host2.com host3.com" > >for HOST in $PING_REMOTE_HOSTS >do > UP=0 > while [ $UP -eq 0 ] > do > sleep 120 > ping $HOST -qc 1 >/dev/null 2>&1 > UP=$? > done > echo "$HOST is down, trying next host..." >done Once you have wasted all the hosts in your list you restart your network, although IMHO this only means that host3.com cannot be pinged. I believe you want to do something like #!bin/bash PING_REMOTE_HOSTS="host1.com host2.com host3.com" UP=0 while true do while [$UP -eq 0] do sleep 120 UP = 1 # this would break the inner loop for HOST in $PING_REMOTE_HOSTS do ping $HOST -qc 1 >/dev/null 2>&1 UP &= $? # if any ping returns 0 it is OK done done echo "network is down. restarting..." /etc/init.d/network reload sleep 60 done I have not tested this :-( Erich THINK Püntenstrasse 39 8143 Stallikon mailto:[EMAIL PROTECTED] PGP Fingerprint: BC9A 25BC 3954 3BC8 C024 8D8A B7D4 FF9D 05B8 0A16 _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm ------------------------------------------------------------------------ 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 _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm ------------------------------------------------------------------------ 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