首页 > 系统相关 >linux环境制定定时任务

linux环境制定定时任务

时间:2023-01-29 10:55:49浏览次数:48  
标签:tmp bin sleep && linux date 定时 txt 制定

1. 每隔5秒执行一次

编辑 crontab -e

点击查看代码
*/1 * * * * /bin/date >>/tmp/date.txt
*/1 * * * * sleep 5  && /bin/date >>/tmp/date.txt
*/1 * * * * sleep 10 && /bin/date >>/tmp/date.txt
*/1 * * * * sleep 15 && /bin/date >>/tmp/date.txt
*/1 * * * * sleep 20 && /bin/date >>/tmp/date.txt
*/1 * * * * sleep 25 && /bin/date >>/tmp/date.txt
*/1 * * * * sleep 30 && /bin/date >>/tmp/date.txt
*/1 * * * * sleep 35 && /bin/date >>/tmp/date.txt
*/1 * * * * sleep 40 && /bin/date >>/tmp/date.txt
*/1 * * * * sleep 45 && /bin/date >>/tmp/date.txt
*/1 * * * * sleep 50 && /bin/date >>/tmp/date.txt
*/1 * * * * sleep 55 && /bin/date >>/tmp/date.txt

:wq
查看crontab命令
crontab -l

查看效果

2. 每9分钟执行

编辑crontab文件
crontab -e
*/9 * * * * /bin/date >> /tmp/date.txt
查看crontab命令
crontab -l

查看效果

3.

标签:tmp,bin,sleep,&&,linux,date,定时,txt,制定
From: https://www.cnblogs.com/bonne-chance/p/17072014.html

相关文章