2009-08-13 19:35:36 +00:00
|
|
|
#!/bin/sh
|
2008-10-21 18:23:18 +00:00
|
|
|
#egan@us.ibm.com
|
|
|
|
#(C)IBM Corp
|
|
|
|
#
|
|
|
|
|
|
|
|
SERIAL=""
|
|
|
|
ETH=""
|
|
|
|
Q=0
|
|
|
|
while [ -n "$1" ]
|
|
|
|
do
|
|
|
|
case "$1" in
|
|
|
|
-q)
|
|
|
|
Q=1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-s)
|
|
|
|
SERIAL="on"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-i)
|
|
|
|
shift
|
|
|
|
ETH=$1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
LEFT="$LEFT $1"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -n "$LEFT" ]
|
|
|
|
then
|
|
|
|
set $LEFT
|
|
|
|
fi
|
|
|
|
|
|
|
|
nodes=`echo $1 |sed "s/,/ /g"`
|
2011-10-30 09:03:17 +00:00
|
|
|
if [ -n "$ETH" ]; then
|
2011-10-31 10:59:01 +00:00
|
|
|
nodes=`echo $nodes |sed "s/-hf[0-9]//g"`
|
|
|
|
nodes=`echo $nodes |sed "s/ /-$ETH /g"`
|
|
|
|
nodes="$nodes-$ETH"
|
2008-10-21 18:23:18 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
which fping >/dev/null 2>&1
|
|
|
|
if [ "$?" = "0" ]; then
|
|
|
|
if [ "$Q" = "1" ]; then
|
|
|
|
fping $nodes 2>&1 | grep -v 'is alive' | sed "s/ is unreachable/: noping/"
|
|
|
|
else
|
|
|
|
fping $nodes 2>&1 | sed "s/ is alive/: ping/" | sed "s/ is unreachable/: noping/"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
JOBS=""
|
|
|
|
for i in $nodes
|
|
|
|
do
|
|
|
|
(if ping -c1 $i >/dev/null 2>&1
|
|
|
|
then
|
|
|
|
if [ "$Q" = "0" ]; then
|
|
|
|
echo "$i: ping"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "$i: noping"
|
|
|
|
fi) &
|
|
|
|
if [ -z "$SERIAL" ]; then
|
|
|
|
JOBS="$JOBS $!"
|
|
|
|
else
|
|
|
|
wait $!
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
wait
|
|
|
|
fi
|
|
|
|
exit 0
|