while true; do ping -c 1 www.baidu.com | awk '{print "["strftime("%F %H:%M:%S")"]:"$0}' |grep from >> ping.log;sleep 1; done &
在ping百度的时候发现ping的次数多了之后百度会拒绝,所以改为ping天气网站
while true; do ping -c 1 www.weather.com.cn | awk '{print "["strftime("%F %H:%M:%S")"]:"$0}' |grep from >> ping.log;sleep 1; done &