linux中crontab实现以秒执行任务

用crontab+sleep实现以秒执行任务

  crontab -e

  * * * * * /bin/date >>/tmp/date.txt

  * * * * * sleep 10s; /bin/date >>/tmp/date.txt   //暂停10秒后执行命令

  * * * * * sleep 20s; /bin/date >>/tmp/date.txt

  * * * * * sleep 30s; /bin/date >>/tmp/date.txt

  * * * * * sleep 40s; /bin/date >>/tmp/date.txt

  * * * * * sleep 50s; /bin/date >>/tmp/date.txt

当然sleep的单位也有分,时,天

分别是 m , h , d

sleep 40m;

sleep 40h;

sleep 40d;

posted @ 2015-10-20 17:40  沙琪玛  阅读(375)  评论(0编辑  收藏  举报