定时任务每隔一周的周五执行
* * * * 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定时任务 每隔一周的周五执行》对你有帮助,请点赞、收藏,并留下你的观点哦!