Version: v1.1
Type: Full Script
Category: Networking
License: GNU General Public License
Description: php page that runs a bash script to check for responses from a list of hosts/nodes bash script included ;)
#!/bin/bash
#
# accecpts a file as a list of nodes to ping to check for responses
myList=$1
# reads the file and for each item in the file, tries
# to ping it, if it gets a response awk $7 (which is
# % of packet loss) determines if the node is OK or
# got No Response
for i in $( /bin/cat $myList );
do
echo $i ;
ping $i -n -c 1 -w 1 | grep packet | awk '$7 == "0%" {print " ...is OK"}
;$7 =="100%" {print " ...Did Not Respond!"}'
done
# make sure your 'ping' line is only one(1) line
# funny how there is more comments in here then code, hey?
# ;) jason@phishie.net