rasc
Joined: 11 Oct 2009 Posts: 95
|
Posted: Sat Nov 24, 2012 4:43 am Post subject: Linux script for pinging hosts /w reply value |
|
|
Hi,
what a pity you do not have 'ping' implemented in Linux rma
We enhanced your ping script a bit to get reply values.
It might help someone...
Regards
Ping host (advanced)
Code: | #!/bin/sh
# ping -c $2 -w 4 $1 1> /dev/null 2> /dev/null
PingResult=`ping -c $2 -w 4 $1 | grep icmp_seq | awk -F= '{ print $4 }'`
if [ -z "$PingResult" ]
then
echo "ScriptRes:No answer:dead"
else
echo "ScriptRes:Host is alive:"$PingResult
fi |
|
|