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;