[CentOS] Re: Shell script - ping
kapil singh
kapilsingh.linux at gmail.comMon Jul 28 17:15:02 UTC 2008
- Previous message: [CentOS] Re: Shell script - ping
- Next message: [CentOS] Re: Shell script - ping
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello, This is a running shell script for ping multiple host it provides result directly: if host is successfully ping then it returns Host is alive. otherwise Host is not alive Try this i am working with that in my local n/w. #/bin/bash for n in {1..5}; do host=192.168.1.$n ping -c2 $host &> /dev/null if [ $? = 0 ] ; then printf "%-30s is alive \n" $host else printf "%-30s is not alive \n" $host fi done Note: 1.Replace ip with your ip range 2.Replace the no. of ip according to your need.(means value of n in for loop) -- Thanks and Regards, Kapil Singh Kushwah Linux System Administrator Hotwax Media Inc. Indore,(M.P) INDIA -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20080728/61879a64/attachment-0001.html>
- Previous message: [CentOS] Re: Shell script - ping
- Next message: [CentOS] Re: Shell script - ping
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the CentOS mailing list