i am looking to execute a crone job in Linux. it should run every 3 hour and 40 minutes.
I have tried */40 */3 * * * command, I am not getting this properly executed.
thanks in advance .
cron is time based, not interval based, and the interval 3 hour 40 minutes i.e. 220 minutes is not a factor of the number of minutes in a day i.e. 24x60=1440, so the event is not a recurring event. so there is no way to use cron. if the interval is a factor of 1440, it's possible to use cron, you may refer to How to do a cron job every 72 minutes
Related
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.
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.
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.
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:
#306 12-feb-2015 6:34
#305 11-feb-2015 13:34
#304 11-feb-2015 6:34
#303 10-feb-2015 13:34
#302 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.
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