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

Reply via email to