问题描述
我想在jenkin安排两周的工作。它应该每隔一个星期一运行。我不能弄清楚cron表达式
I wanted to schedule fortnightly job on jenkin . It should run every other Monday . I am not able to figure out the cron expression
推荐答案
我做了一些研究,它基本上归结为3个答案我可以找到:
I did a little research, and it basically comes down to 3 answers that I can find:
快速回答:您不能。
strong>复杂答案1 :您可以在单独一行上为每隔一个星期日手动输入一个条目,但在年变化时会遇到问题
Complex answer 1: You could manually put in an entry for every other Sunday on a separate line, but this will run into problems when the year changes
0 0 29 4 *
0 0 13 5 *
0 0 27 5 *
0 0 10 6 *
...
复杂答案2 :创建每个星期日运行的cron条目,然后在构建步骤中使用一些手动检查(切换)来解决问题的其他部分。 (如果您需要在SCM步骤之前进行测试,则pre-scm-buildstep插件可能会有帮助。)
Complex answer 2: Create a cron entry that runs every Sunday, and then use something in your build steps that manually checks (toggles) to solve the "every other" part of the problem. (If you need to do the test before the SCM step, the pre-scm-buildstep plugin might help.)
这篇关于在jenkins上安排两周的工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!