写一个sh文件:

#!/bin/bash
while true
do
    echo `date +"%Y-%m-%d %H:%M:%S";ping -c 1 $1|grep -i from 2>&1`
    sleep 1
done

 

保存成ping.sh,赋可执行权限:

chmod +x ping.sh

 

执行:

sh ./ping.sh 192.168.1.6 > ./1.log

 

在后台执行:

nohup sh ./ping.sh 192.168.1.6 > ./1.log &

 

相关文章:

  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-18
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-02
  • 2021-07-07
  • 2021-08-02
  • 2022-12-23
  • 2022-12-23
  • 2021-06-21
  • 2022-12-23
相关资源
相似解决方案