Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Schedule Fortnightly jobs on jenkins

Tags:

cron

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

like image 334
Edge Avatar asked Apr 25 '12 11:04

Edge


2 Answers

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

like image 153
jwernerny Avatar answered Sep 23 '22 13:09

jwernerny


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.

like image 34
Carlos Tasada Avatar answered Sep 25 '22 13:09

Carlos Tasada