リモートホストが動作しているかを監視する
#!/bin/sh #is_host_alive.sh host_name PING="ping" PING_OPT="-c 1" PING_ALIVE='0%' $PING $PING_OPT $1 | grep -q "$PING_ALIVE" if [ $? -eq 0 ]; then echo $1 is alive exit 0 else echo $1 is not avive exit 1 fi
$ ./is_host_alive.sh localhost localhost is alive $ ./is_host_alive.sh 1 1 is not avive