ping 호스트 스크립트

 
  hosts 
[root@serv~]# more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
192.168.70.178     serv

 hosts ping , hosts IP 
[root@serv ~]# more ping.sh
#!/bin/bash
#ping all host from /etc/hosts
#grab /etc/hosts and ping each address

cat /etc/hosts |grep -v '^#' |grep -v '^

|grep -v '^127.0.0.1'|while read LINE
do
        address=`awk '{ print  }'`
        for machine in $address
        do
                ping -c 1 $machine
        done
done
exit 0

 127.0.0.1 localhost.localdomain 
 192.168.70.178 

[root@serv ~]# ./ping.sh

PING 192.168.70.178 (192.168.70.178) 56(84) bytes of data.
64 bytes from 192.168.70.178: icmp_seq=1 ttl=64 time=0.017 ms

--- 192.168.70.178 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.017/0.017/0.017/0.000 ms
PING servyou_web (192.168.70.178) 56(84) bytes of data.
64 bytes from servyou_web (192.168.70.178): icmp_seq=1 ttl=64 time=0.013 ms

--- servyou_web ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.013/0.013/0.013/0.000 ms




 

  
 

  
 

좋은 웹페이지 즐겨찾기