What is the cron syntax for scheduling a Jenkins job:
a) monthly b) weekly
Thanks!
Jenkins provides a helpful overview here. If you tick on Build periodically in the job configuration, you can click on the question mark next to Schedule.
I just want to quote one small part of it (it's always helpful to read the entire help yourself):
This field follows the syntax of cron (with minor differences). Specifically, each line consists of 5 fields separated by TAB or whitespace:
MINUTE HOUR DOM MONTH DOW MINUTE Minutes within the hour (0–59) HOUR The hour of the day (0–23) DOM The day of the month (1–31) MONTH The month (1–12) DOW The day of the week (0–7) where 0 and 7 are Sunday.
[...]
In addition, @yearly, @annually, @monthly, @weekly, @daily, @midnight, and @hourly are supported as convenient aliases. These use the hash system for automatic balancing. For example, @hourly is the same as
H * * * *
and could mean at any time during the hour. @midnight actually means some time between 12:00 AM and 2:59 AM.
Jenkins also supports predefined aliases to schedule build:
@hourly, @daily, @weekly, @monthly, @midnight
@hourly --> Build every hour at the beginning of the hour --> 0 * * * *
@daily, @midnight --> Build every day at midnight --> 0 0 * * *
@weekly --> Build every week at midnight on Sunday morning --> 0 0 * * 0
@monthly --> Build every month at midnight of the first day of the month --> 0 0 1 * *
For weekly I successfully use: H 0 * * 0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With