user3174355
user3174355

Reputation: 65

Jenkins scheduled job

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!!!

Upvotes: 0

Views: 771

Answers (1)

Technext
Technext

Reputation: 8107

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

Upvotes: 1

Related Questions