Summary: scripting tricks (shell, expect,...)

From: Andreas Hoeschler <ahoesch_at_smartsoft.de>
Date: Fri May 17 2002 - 11:35:56 EDT
Hi all,

thanks a lot for the overwhelming feedback to my question. I got about 
30 answers in 5 minutes. I am still browsing through all the replies. 
Most of you suggested to do something like

#!/bin/bash
ping snap >/dev/null
if [ $? != 0 ]; then
   echo snap is down! Do something about it...
else
   echo snap is already on!
fi

which worked great for me.

Thanks again!

Regards,

    Andreas


=========================================================
Original question:
this is a question for shell script gurus. I need a script called by 
cron that performs a specific action (call another script) if host snap 
is down. I thought about checking this with

bash-2.03# ping snap
no answer from snap

If snap is down the answer "no answer from snap" is returned. But how 
can I use this in a shell or expect script to call my action script? If 
the answer "snap is alive" is returned I want to do nothing. I guess 
this can easily be done but I am unfortunately not such a script expert 
yet.
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Fri May 17 11:45:34 2002

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:43 EST