On Monday 2004 May 10 12:00, Eduardo Mapalo wrote:
> Hello guys,
>
>       Can someone provide me with a simple script that can execute a command
> once the other server is Unreachable. Here's the condition.
>
> 1.) keep pinging server B
> 2.) if server B is "Unreachable" execute a command...ex. service network
> restart
> 3.) if server B is active/alive do nothing.
> 4.) exit
>
> Thanks in advance...

You might want to modify this a bit, but i works as is.
----
#!/bin/sh

host="<HOST>";
cnt=1;
inactive="`ping -c $cnt $host | grep Unreachable`";
echo "$host";
while [ ! "$inactive" ]; do
        inactive="`ping -c $cnt $host | grep Unreachable`";
done
<COMMAND>
----
HTH.

Are you sure you want to do that? Or maybe you mean something else?

-- 
eman calso
http://www.bloodpet.tk/
Adore, v.:
        To venerate expectantly.
                -- Ambrose Bierce, "The Devil's Dictionary"

--
Philippine Linux Users' Group (PLUG) Mailing List
[EMAIL PROTECTED] (#PLUG @ irc.free.net.ph)
Official Website: http://plug.linux.org.ph
Searchable Archives: http://marc.free.net.ph
.
To leave, go to http://lists.q-linux.com/mailman/listinfo/plug
.
Are you a Linux newbie? To join the newbie list, go to
http://lists.q-linux.com/mailman/listinfo/ph-linux-newbie

Reply via email to