${subnet}#!/bin/bash
subnet="192.168.100"
`rm -rf ${subnet}_Up.log`
`rm -rf ${subnet}_Down.log`

for i in $(seq 1 254)
do
    ping -c 1 -w 1 ${subnet}.$i && result=0 || result=1
    if [ "$result" -eq 0 ]; then
        echo "${subnet}.$i is Up" >> ${subnet}_Up.log
    else
        echo "${subnet}.$i is Down" >> ${subnet}_Down.log
    fi
done
arrow
arrow
    全站熱搜

    dreamtails 發表在 痞客邦 留言(0) 人氣()