ping加时间

ping加时间

   小樱     2022年6月25日 10:42     727    

vim pingtest.sh

#/bin/bash 
ping www.baidu.com |while read result 
do 
echo "$(date) ${result}" 
done


在后台进行执行

chmod +x pingtest.sh

nohup ./pingtest.sh > ping.log &

tail -f ping.log

Wed Jun 15 01:35:07 GMT 2022 64 bytes from x.x.x.x: icmp_seq=2471 ttl=57 time=153 ms

Wed Jun 15 01:35:08 GMT 2022 64 bytes from x.x.x.x: icmp_seq=2472 ttl=57 time=153 ms

Wed Jun 15 01:35:09 GMT 2022 64 bytes from x.x.x.x: icmp_seq=2473 ttl=57 time=153 ms

Wed Jun 15 01:35:10 GMT 2022 64 bytes from x.x.x.x: icmp_seq=2474 ttl=57 time=153 ms

Wed Jun 15 01:35:11 GMT 2022 64 bytes from x.x.x.x: icmp_seq=2475 ttl=57 time=153 ms

Wed Jun 15 01:35:12 GMT 2022 64 bytes from x.x.x.x: icmp_seq=2476 ttl=57 time=153 ms


文章评论

0

其他文章