将 cron 选项卡设置为工作日的特定时间 [英] setup cron tab to specific time of during weekdays

查看:25
本文介绍了将 cron 选项卡设置为工作日的特定时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 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

07 代表星期日
6 代表星期六
所以,1-5 表示从周一到周五

0 and 7 stand for Sunday
6 stands for Saturday
so, 1-5 means from Monday to Friday

这篇关于将 cron 选项卡设置为工作日的特定时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆