MRKAVANA (mrkavana@gmail.com) - www.facebook.com/kavanathai

Jul 18, 2011

How to write a simple script to do a ping check using bash scripting

This script will work in all linux/unix operating systems like Redhat, Fedora, Centos, Solaris, Ubuntu, Debian etc, if they are having bash shell or sh.
First we have to set a variable status and an IP to check. 

See the example given below :

#!/bin/bash
#Purpose : TO check whether a system is up and working or not using a simple ping check.
IP=192.168.0.21
status=1
until [ "$status" -eq "0" ]
do
        ping -c 1 $IP > /dev/null
        status=`echo $?`
                if [ "$status" = "1" ]




No comments:

Post a Comment