每天在特定时间运行 CRON 作业 [英] Run CRON job everyday at specific time

查看:43
本文介绍了每天在特定时间运行 CRON 作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我每天下午 3 点运行我的 cron 工作

Right now i am running my cron job everyday at 3.00PM

0    15    *    *    *

但我想在一天内运行两次我的 cron 作业.上午 10.30 和下午 2.30

But I want to run my cron job twice in a day. 10.30AM and 2.30PM

0    30 10    *    *    *

我相信这个命令会在 10.30AM 运行.我应该如何在下午 2.30 运行它?

I believe this command will run at 10.30AM. How should i run it in 2.30PM?

推荐答案

Cron 实用程序是一种在特定时间和/或日期持续安排日常后台作业的有效方法.

Cron utility is an effective way to schedule a routine background job at a specific time and/or day on an on-going basis.

Linux Crontab 格式

MIN HOUR DOM MON DOW CMD

MIN HOUR DOM MON DOW CMD

示例::在特定时间安排作业

cron 的基本用法是在特定的时间执行一个作业,如下图.这将在 6 月 10 日上午 08:30 执行完整备份 shell 脚本(完整备份).

The basic usage of cron is to execute a job in a specific time as shown below. This will execute the Full backup shell script (full-backup) on 10th June 08:30 AM.

请注意,时间字段使用 24 小时格式.所以,早上 8 点使用8 点,晚上 8 点使用 20 点.

Please note that the time field uses 24 hours format. So, for 8 AM use 8, and for 8 PM use 20.

30 08 10 06 * /home/yourname/full-backup

  • 30 – 30 分钟
  • 上午 08 点至 08 点
  • 第 10 – 10 天
  • 06 – 第 6 个月(6 月)
  • *– 一周中的每一天
  • 在您的情况下,对于 2.30PM

    In your case, for 2.30PM,

    30 14 * * * YOURCMD
    

    1. 30 – 30 分钟
    2. 中午 14 点至下午 2 点
    3. *– 每天
    4. *– 每个月
    5. *– 一周中的每一天

    要了解有关 cron 的更多信息,请访问此网站.

    To know more about cron, visit this website.

    这篇关于每天在特定时间运行 CRON 作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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