Schedule time on jenkins job is misbehaving even though cron seems right - jenkins

I have to build a job everyday at 09:29AM(UTC) but it's building at 11:AM ( UTC )
My cron is:
H 09 * * 1-7
What can be the cause if cron is not an issue? Or is it ?

Option H takes the random min of the Hour. for a specific time 9:29 AM Cron Expression should be
29 09 * * 1-7
Also for timing can you confirm the Timezone and Daylight option settings.

Related

How do I schedule a build job in Jenkins from 8 PM to 6 AM?

I need to schedule a Jenkins job for every minute from 8 PM to 6 AM. Is there any way to do this in Jenkins? The hour options are from 0-23: for example it will work with * 6-20 * * * (from 6 am to 8 pm) but I want something like * 20-6 * * *.
You can apply more than one schedule for a Jenkins job.
0 0/1 20/1 ? * * *
0 0/1 0-6 ? * * *
The first expression will build the job every minute starting at minute 00, every hour starting at 20:00, of every day.
The second expression will build the job every minute starting at minute 00, every hour between 00:00 and 06:00, of every day.
In this way the job is scheduled to build every minute from 8 PM to 6 AM.

Jenkins Cron Syntax - How to Perform a Half of Hour

The requirement for my pipeline schedule is from 09:00 pm to 04:30 am I wrote the schedule like this triggers { cron('H H(21-4:30) * * *') } but it did not work, so how to correct this?
I think following cron will work for you.
H/30 21-23,0-4 * * *
At every 30th minute past every hour from 21 through 23 and every hour from 0 through 4.

Schedule job to run periodically

I am trying to run Jenkins job everyday at 10 AM and 10 PM . How do i do that?
Currently i use the below to run at 12 AM and 12 PM . Am not aware how to change it.
0 0-23/12 * * *
Its difficult to acheive it with just a single crontab entry, what you can do is to have a 2 crontab entry like below :-
for job which you want to run daily at 10 AM :-
0 10 * * *
And for 10 PM job 0 22 * * *.
Here first entry denotes the minute, second denotes the hour and then day,month and week.
Just click the "?" icon to the right of the "Schedule" field, and you'll see a detailed explanation of the syntax available there.
If you want it to run at 12am and 12pm, I would guess you would just do this:
0 0,12 * * *
Suppose you want to run a jenkins job at 4:30 AM , monday to saturday, then you can use below script under your jenkins build trigger:
30 04 * * 1-6
1-6 denotes monday to saturday
Coming back to your question, you can configure 2 entries under your build trigger to run Jenkins job everyday at 10 AM and 10 PM in jenkins as shown below:
00 10 * * 1-7
00 22 * * 1-7

Why Jenkins does not run a job as scheduled?

I have this 'Build periodically' option with the following 'Schedule':
H 6,13 * * *
Meaning that I want this job to be run everyday at 6:00 and 13:00.
I noticed that it does not run at the specified time but 34 minutes later instead. These are the last builts:
#3​06 12-feb-2015 6:34
#3​05 11-feb-2015 13:34
#3​04 11-feb-2015 6:34
#3​03 10-feb-2015 13:34
#3​02 10-feb-2015 6:34
Plus, under the 'Schedule' text area there is a note saying:
Would last have run at Thursday, February 12, 2015 6:34:42 AM CET;
would next run at Thursday, February 12, 2015 1:34:42 PM CET.
This is not a big deal, but it is a bit annoying that there is a 34 minutes delay. Does anyone know why this is happening and how to solve it (without manually adding this delay on the schedule)?
Replace the H by 0 to have 6:00.
The H is intended to distribute tasks over the hour, so not all Jenkins tasks start exactly at 06:00 etc. (so it is not a delay, but a different way of scheduling).
Two different tasks scheduled both at H 13 * * * will start at different minutes but still between 13:00 and 13:59:59, so they won't make your system too slow. The H value is the job specific hash value, so it will still be a constant within the job, but different between jobs.

Jenkins SCM Polling - Biweekly (Every Two Weeks)

Currently I am polling SCM
H H(0-8) * * 5
Which I intend to mean: poll between midnight and 8am on Friday.
What I would like is to poll every OTHER Friday.
The accepted answer does not work in Jenkins:
Invalid input: "0 0-8 * * 5/2": line 1:12: unexpected token: /
So take a look at this answer (and vote that up in case it helps):
H H 8-14,22-28 * 5
"Run at some hour and some minute (see here for the meaning of H) every Friday (=the 5th day, see here), if that Friday happens to be between day 8-14 or 22-28 of month." Looks good in my local Jenkins, skipping the run on January 31st:
Would last have run at Friday, January 24, 2020 12:39:59 AM UTC; would next run at Friday, February 14, 2020 12:39:59 AM UTC.
I haven't tried this in Jenkins, but I believe the normal cron syntax would be: 0 0-8 * * 5/2
The following statement helps you to run it bi-weekly at 08:00 A.M on Friday.
00 08 */2 * 5

Resources