::: SCRIPT :::/ㄴ ::: Shell :::

shell icmp check script

호딩이 2011. 12. 8. 16:31


#!/bin/sh

while read LINE
do
ip=`echo $LINE | cut -d ":" -f 1`
hst=`echo $LINE | cut -d ":" -f 2`
        if /usr/sbin/ping $ip -n 1 -m 1 > /dev/null;
        then
        echo "$hst ok"
        else
        echo "$hst fail"
        fi

done < iplist.lst


iplist.lst
10.10.10.10:klcom1
10.10.10.2:klcom2

이런식으로.. ㄱㄱㄱ 허접함