0

知道如何创建脚本以测试与代表默认网关的 IP 的连接性。在连接的情况下,打印消息“默认网关打开”,如果未连接,则显示消息“默认网关关闭”

4

1 回答 1

1
#!/bin/bash 
ping -c 1 192.168.1.1 2>&1 > /dev/null
if [ $? -ne 0 ]
then 
       echo -e "host does not respond to ping" 
fi

Put this script in crontab and let it run every min or whatever frequency you want.

于 2013-02-09T22:46:21.710 回答