linux - 您如何安排多个日期的 cron 作业?

标签 linux ubuntu cron

我想知道这是否正确。

我想为多个日期安排一个 cron 作业,例如:

  • 2016 年 12 月 7 日
  • 2017 年 1 月 14 日
  • 2017 年 2 月 21 日

30 9 7,14,21 12,1,2 * my_awesome_script...

虽然我可以等到下一个日期再看看它是否有效...我只是不想:)

最佳答案

如果没有共同的模式,值得使用三个不同的行:

0 0  7 12 * your_awesome_script
0 0 14  1 * your_awesome_script
0 0 21  2 * your_awesome_script

您可以尝试利用星期几等来获得复杂的语法,但这会变得非常难以理解。

记住格式:

 +---------------- minute (0 - 59)
 |  +------------- hour (0 - 23)
 |  |  +---------- day of month (1 - 31)
 |  |  |  +------- month (1 - 12)
 |  |  |  |  +---- day of week (0 - 6) (Sunday=0 or 7)
 |  |  |  |  |
 *  *  *  *  *  command to be executed

关于linux - 您如何安排多个日期的 cron 作业?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41019795/

相关文章:

linux - MonoDevelop 产生 "Error launching web browser"——如何解决这个问题?

linux - Dependency Walker 等同于 Linux?

linux - 脚本中的 bash for 循环不会作为非根 cron 脚本运行

java - 如何有条件地启用或禁用 Spring 中的计划作业?

cron - 无法将 CRON 表达式设置为 cloudFormation 堆栈的参数

linux - mk项目 : command not found in shell script

java - 警告 : Failed to load the sqljdbc_auth. dll 导致 : no sqljdbc_auth in java. library.path

ubuntu - 使用 EC2 Ubuntu 13 设置 Sublime SFTP

docker - 在 dind 中从 armhf/ubuntu 构建时,回显 docker 文件中的文件失败

linux - 动态查找shellcode的地址,放置在堆栈上