How to know if the remote machine is down
#! / bin/bashmail=2422606568@qq.comwhile true do ping-c 2 > / dev/null 2 > & 1 if [$?-ne 0]; then echo "| mail-s" ping baidu is down "$mail else echo" baidu is ok "fi; sleep 30 done
#! / bin/bashmail=2422606568@qq.comwhile true do ping-c 2 > / dev/null 2 > & 1 if [$?-ne 0]; then echo "| mail-s" ping baidu is down "$mail else echo" baidu is ok "fi; sleep 30 done