很多时候,我们计划任务需要精确到秒来执行,根据以下方法,可以很容易地以秒执行任务。
以下方法将每10秒执行一次
 
1
2
3
4
5
6
7
# crontab -e
* * * * * /bin/date >>/tmp/date.txt
* * * * * sleep 10; /bin/date >>/tmp/date.txt
* * * * * sleep 20; /bin/date >>/tmp/date.txt
* * * * * sleep 30; /bin/date >>/tmp/date.txt
* * * * * sleep 40; /bin/date >>/tmp/date.txt
* * * * * sleep 50; /bin/date >>/tmp/date.txt