KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Linux script for pinging hosts /w reply value

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Library
View previous topic :: View next topic  
Author Message
rasc



Joined: 11 Oct 2009
Posts: 95

PostPosted: Sat Nov 24, 2012 4:43 am    Post subject: Linux script for pinging hosts /w reply value Reply with quote

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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Library All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index