Monday, July 13, 2009

Command to check whether the sytem is alive or not


fping is a ping like program which uses the (ICMP) echo request to determine whether an ip is up or not.

fping is different from ping in that you can specify any number of hosts on the command line, or specify a file containing the lists of hosts to ping.

fping will send out a ping packet and move on to the next host in a round-robin fashion.

If a host replies, it is noted and removed from the list of hosts to check. If a host does not respond within a certain time limit and/or retry limit it will be considered unreachable.

Unlike ping, fping is meant to be used in scripts .
Really helpful when we need to set the status of the a particular host in our applications.

Download Link

download and install the software. Type fping -h will list out the various parameters.

Example shell script

status=`fping | cut -d ' ' -f 1`
if [ $status != "alive" ]
echo 'Server Down. Please check the network'

No comments:

Post a Comment


Related Posts with Thumbnails