Jenkins scheduled job - jenkins

Is possible to scheduled a jenkins job to repeat a task every 45 min in a time interval?
Example (Repeat the job every 45 min as many times as possible since 10:00 am to 16:00 pm) - result would be 8 executions.
Thanks!!!

Yes. In the job configuration page, search for the section Build Triggers. In this section, enable Build periodically and put the following lines:
0,45 0-23/3 * * *
30 1-23/3 * * *
15 2-23/3 * * *
Reference: Is the following cron expression means every 45 minutes?
Explanation:
0,45 means to run at 0 mins and 45 mins for ex. 2 am and 2:45 am
0-23/3 in hour field means that a particular activity has to be performed every 3 hrs. In this case, it means 0, 3, 6, 9,... till 21 hrs (or 2100 hrs). Similarly for others.
So, first line i.e., 0,45 0-23/3 * * * takes care of 0000 hrs and 0045 hrs. Next time (+45 mins) will be 0130 hrs which will be taken care by 30 1-23/3 * * * and so on.
You can check the cron format details here: http://en.wikipedia.org/wiki/Cron

Related

Jenkins build periodically every 2 hours after 10 PM to next day 7AM

H H(22-7)/2 * * 1-5 ----- not working
Please let me know correct example
0 0,2,4,6,22 * * *
This will trigger the job at 10 PM, 12 AM, 2 AM, 4 AM and 6 AM everyday.
In case you need to distribute load, you can replace the first 0 with an H.

Cron expression for trigger job for next 3 days after initial trigger

I want a Jenkins job to run for 3 days at interval of 24 hrs. after initial trigger of Job.
Say if i trigger the job now . It should run at (now + 24) then at (now + 48) and later (now + 72).
I could find a expression : '0 */24 * * */3' , This runs At 0 minutes past the hour, every 24 hours, every 3 days of the week .
Need some help to modify as per initial requirement.

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.

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

How to schedule a Jenkins job each 15 minutes [duplicate]

This question already has an answer here:
Jenkins Build Periodically - Schedule
(1 answer)
Closed 6 years ago.
I need to schedule a jenkins job each 15 minutes.
Currently i'm using the Build periodically feature but that enables me to schedule the job once in 1 hour maximum.
What i got now is:
15 * * * * is running the job HOURLY (each XX:15)
15 0 * * * is running the job DAILY on 00:15
What is the right cron-expression that will run the job every 15 minutes?
To run the job at a regular interval of 15 minutes you have to write it like below:
*/15 * * * * - Will run at every 15 minutes (may be at XX:01,XX:16,XX:31 ..)
Where */15 specifies no matter whatever is Hour (H) run it at 15 every minutes.

Resources