将Cron标签设置为工作日中的特定时间 [英] setup cron tab to specific time of during weekdays
问题描述
我正在尝试在Ubuntu服务器上设置cron作业.我们希望cron作业在一天中的特定时间和一周中的某些特定日期运行脚本.例如,我们要设置一个cron作业,按以下顺序运行脚本:
I am trying to setup a cron job on a Ubuntu server. We want the cron job to run the script at certain times of the day and on some specific days of the week. For example, we want to setup a cron job that runs the script with the following sequence:
在工作日的上午9点至下午2点之间每2分钟执行一次脚本.
Execute the script every 2 minutes from 9 am to 2 pm during the weekdays.
到目前为止,这是我能够做到的:
This is what I have been able to do so far:
*/2 09-14 * * */path_to_script
*/2 09-14 * * * /path_to_script
我平日应该做什么?
推荐答案
与您的工作时间相同:
*/2 09-18 * * 1-5 /path_to_script
0
和7
代表星期日
6
代表星期六
因此,1-5
表示从星期一到星期五
0
and 7
stand for Sunday
6
stands for Saturday
so, 1-5
means from Monday to Friday
这篇关于将Cron标签设置为工作日中的特定时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!