7
votes

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
@AndersLindahl its a weekly cron. I am looking at fortnightly cron. It should run every OTHER MondayEdge

3 Answers

8
votes

I did a little research, and it basically comes down to 3 answers that I can find:

Quick answer: You can't.

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 *
...

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.)

1
votes

In your project Configure / Build Triggers / Schedule section you can specify @weekly

That will be executed after midnight the first day of the week, based in you JVM locale.

That's the closest you will get from inside Jenkins. Otherwise you'll need to use some external cron job.

0
votes
0 0 * * #1,#3

According to this, the hash character should allow the above expression to give you a build at midnight, every month, on the first and 3rd Mondays. This is as close as I could find to every-other-Monday.