失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > crontab 每周五_crontab定时任务 每隔一周的周五执行

crontab 每周五_crontab定时任务 每隔一周的周五执行

时间:2020-01-11 10:12:06

相关推荐

crontab 每周五_crontab定时任务 每隔一周的周五执行

定时任务每隔一周的周五执行

* * * * 05 /bin/bash -c (($(date +\%s) / 86400 \% 14)) && your-script

测试是否成功执行命令

写入定时任务

crontab -e

01 04 * * 05 /bin/bash -c (($(date +\%s) / 86400 \% 14)) && /bin/date +\%F_\%w >>/tmp/date.log

修改时间进行测试,这里注意修改为周五,时间与定时任务中的时间相近

date -s "0803"

date -s "04:00"

---------------------------------

date -s "0810"

date -s "04:00"

---------------------------------

date -s "0817"

date -s "04:00"

---------------------------------

date -s "0824"

date -s "04:00"

---------------------------------

date -s "0831"

date -s "04:00"

---------------------------------

date -s "0907"

date -s "04:00

如果觉得《crontab 每周五_crontab定时任务 每隔一周的周五执行》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。