xywuyiba8 发表于 2018-8-22 08:39:06

shell脚本实现每秒执行一次任务

  vi /tmp/ceshi.sh
  #!/bin/sh
  while [ true ]; do
  /bin/sleep 1
  /bin/date >>/tmp/date.txt
  done
  2.后台运行
  nohup /tmp/ceshi.sh 2>&1 > /dev/null &
  3.确认每秒执行
  tail -f /tmp/date.txt
  4. 停止脚本运行进程
  ps -ef | grep ceshi.sh |kill -9

页: [1]
查看完整版本: shell脚本实现每秒执行一次任务