Edge
Edge

Reputation: 732

Schedule Fortnightly jobs on jenkins

I wanted to schedule fortnightly job on jenkin . It should run every other Monday . I am not able to figure out the cron expression

Upvotes: 7

Views: 3715

Answers (3)

Sagar
Sagar

Reputation: 9503

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.

Upvotes: 0

Carlos Tasada
Carlos Tasada

Reputation: 4444

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.

Upvotes: 1

jwernerny
jwernerny

Reputation: 7048

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

Upvotes: 8

Related Questions