[K12OSN] Script for checking if servers are up.

David Hopkins dahopkins429 at gmail.com
Thu Oct 18 17:43:58 UTC 2007


That is what I would try, but are all your servers on the same
192.168subnet? If they have 2 NIC's, shouldn't you be using the other
interfaces IP
address instead of the one used for the thin clients?

On 10/18/07, Huck <dhuckaby at paasda.org> wrote:
>
> double-replying..
>
> $list = 192.168.0.222,192.168.0.223
>
> for $x in $list
> do
> sleep 30
> if ping -i 3 -c 3 $x
> then continue
> else
> echo "$x down!" | mail -s "222 down" veewee777 at alltel.net
> break
> fi
> done
>
>
>
>
> something like that?
>
>
> Doug Simpson wrote:
> > I am trying to make a script that will ping servers and if they are
> down, send a message. If they are up it won't send a message.
> >
> > The problem I am having is if there are more than one, it won't work.
> >
> > Here is a sample of my script:
> > **********sample begins below*************
> > while (true)
> > do
> > sleep 30
> > if ping -i 3 -c 3 192.168.0.222
> > then
> > continue
> > else
> > echo "192.168.0.222 down!" | mail -s "222 down" veewee77 at alltel.net
> > break
> > fi
> > done
> > **********sample ends above***************
> >
> >
> > If I add a second (or more) to it, it fails to work properly.
> > **********broken sample begins below********
> > while (true)
> > do
> > sleep 30
> > if ping -i 3 -c 3 192.168.0.222
> > then
> > continue
> > else
> > echo "192.168.0.222 down!" | mail -s "222 down" me at here.there
> > break
> > fi
> > if ping -i 3 -c 3 192.168.0.223
> > then
> > continue
> > else
> > echo "192.168.0.223 down!" |mail -s "223 down" me at here.there
> > done
> > ***********broken sample ends above**************
> >
> > Obviously a bogus email address, but it is for reference.
> >  Any ideas?
> >
> > Doug
> >
> > Doug Simpson
> > Technology Specialist
> > De Queen Public Schools
> > De Queen, AR
> > simpsond at leopards.k12.ar.us
> >
> >
> > _______________________________________________
> > K12OSN mailing list
> > K12OSN at redhat.com
> > https://www.redhat.com/mailman/listinfo/k12osn
> > For more info see <http://www.k12os.org>
> >
> >
>
> _______________________________________________
> K12OSN mailing list
> K12OSN at redhat.com
> https://www.redhat.com/mailman/listinfo/k12osn
> For more info see <http://www.k12os.org>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/k12osn/attachments/20071018/ab51773d/attachment.htm>


More information about the K12OSN mailing list