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 &