How do I schedule a Jenkins build such that it would be able to build only at specific hours every day?
For example to start at 4 PM
0 16 1-7 * *
I understand that as, "at 0 minutes, at 4 o'clock PM, from Monday to Sunday, every month", however it builds every minute :(
I would be grateful for any advice. Thanks!
Follow the steps as mentioned below to trigger a Jenkins job automatically based on GitHub's webhook configurations: Step 1: Go to the Configuration page of the respective job and under the build trigger section, check the "GitHub hook trigger for GITScm polling" checkbox and click on the Save button.
For example, you may use source control to manage configuration data that you want to deploy to production daily or weekly. However, instead of having systems “pull” these configurations from source control with locally scheduled cron jobs, you can use Jenkins to act as a central scheduler.
Please read the other answers and comments, there’s a lot more information stated and nuances described (hash functions?) that I did not know when I answered this question.
According to Jenkins' own help (the "?" button) for the schedule task, 5 fields are specified:
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
I just tried to get a job to launch at 4:42PM (my approximate local time) and it worked with the following, though it took about 30 extra seconds:
42 16 * * *
If you want multiple times, I think the following should work:
0 16,18,20,22 * * *
for 4, 6, 8, and 10 o'clock PM every day.
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