#!/bin/sh
ping -c 1 -w 1 172.1.1.5 && result=0 || result=1
if [ "$result" -eq "0" ]; then
echo "Machine 172.1.1.5 is Up."
else
echo "Machine 172.1.1.5 is DOWN."
fi
補充:$result=0表示ping成功,$result=1表示ping失敗!
全站熱搜
#!/bin/sh
ping -c 1 -w 1 172.1.1.5 && result=0 || result=1
if [ "$result" -eq "0" ]; then
echo "Machine 172.1.1.5 is Up."
else
echo "Machine 172.1.1.5 is DOWN."
fi
補充:$result=0表示ping成功,$result=1表示ping失敗!
留言列表