标签:
[root@localhost program_test]# cat list_active_hosts.sh
#!/bin/bash
for ip in 192.168.119.{1..255} ;
do
ping $ip -c 2 &> /dev/null;
if [ $? -eq 0 ];
then
echo $ip is active!
fi
done
[root@localhost program_test]# ./list_active_hosts.sh
192.168.119.1 is active!
192.168.119.2 is active!
5、系统运行时间监视
<pre name="code" class="plain" style="font-size: 14px;">[root@localhost program_test]# cat ssh_test.sh
#!/bin/bash
IP_LIST="192.168.119.1 192.168.119.2 192.168.119.128"
USER="yxy"
for ip in $IP_LIST;
do
utime=$(ssh $USER@$ip uptime | awk ‘{ print $3 }‘ )
echo $ip uptime: $utime
done
标签:
原文地址:http://www.cnblogs.com/poptest/p/4988968.html