IDependOn-Set: 1 IDependOn-Set: 3 IDependOn-Set: 66 IDependOn-Set: 83 IDependOn-Set: 84 IDependOn-Set: 85 LastModifiedSecs: 963381764 Parent: 66 SequenceNumber: 2 Title: pinghost Part: 0 Author-Set: sauer@cloudmaster.com LastModifiedSecs: 963381764 Type: monospaced Lines: 30 #!/bin/bash # # pinghost - Danny Sauer, (last updated Mar 9, 1999) # call as "pinghost host.do.main" # if the host doesn't respond, send an e-mail to the administrator # written for someone on the LUCI mailing list - I forget who hosttoping=$1 adminaddress="root@localhost" failmessage="$hosttoping is not responding." failedpingtext='100% packet loss' myname=${0##/*/} # call me with one argument - the host to ping if [ -z "$1" ]; then echo "usage: $myname hostname" exit 1 fi # ping once, quietly, get the last line, and grab the third chunk hoststatus=$(ping $hosttoping -c1 -q|tail -n1|cut -d, -f3) # get rid of the leading space hoststatus=${hoststatus#\ } # check for failure if [ "$hoststatus" = "$failedpingtext" ]; then echo $failmessage | mail -s "$hosttoping failure" $adminaddress fi EndPart: 0