FS#27675 - [dcron] If a job is scheduled to run within a band of times with a FREQ setting, and if the job
Attached to Project:
Community Packages
Opened by Nick Coleman (NickC) - Thursday, 22 December 2011, 23:02 GMT
Last edited by Evangelos Foutras (foutrelis) - Thursday, 17 January 2013, 01:26 GMT
Opened by Nick Coleman (NickC) - Thursday, 22 December 2011, 23:02 GMT
Last edited by Evangelos Foutras (foutrelis) - Thursday, 17 January 2013, 01:26 GMT
|
Details
Description:
If a job is scheduled to run within a band of times with a FREQ setting, and if the job (for whatever reason) is run towards the end of the band, it will never run again at an earlier time. An example is probably better: I have a job I want to run once a day early in the morning. To cater for the situation when my laptop is closed (i.e. in sleep mode), I set up the crontab like this: * 7-10 * * * FREQ=1d myjob If I open my laptop at 9am, all subsequent runs will never be before 9am due to the FREQ=1d. This means the job could eventually ending up always running at the max(time of all previous runs). The simple solution is to specify FREQ=12h, but perhaps this is not obvious to a casual user of cron. I suspect they would naively specify FREQ=1d because they want it to run every day. Makes sense, right? Well, no, that is not how it works. I read the code and it is not a simple fix (due to the many corner cases one can think of) and you have to ask yourself if it is worth it. Probably the easiest fix is to add a note to crontab.1 in the section where FREQ is described, something like: "Note that if a job runs successfully at the latest possible time, you should specify a FREQ low enough that it can next run at the earliest possible time. The naive setting of 1d for every day may not be best." I go into more detail in a blog post at <http://www.nickcoleman.org/blog/index.cgi?post=cronslackware%21201112181115%21unix> Version 4.5 |
This task depends upon
Closed by Evangelos Foutras (foutrelis)
Thursday, 17 January 2013, 01:26 GMT
Reason for closing: No response
Thursday, 17 January 2013, 01:26 GMT
Reason for closing: No response
Comment by Nick Coleman (NickC) -
Thursday, 22 December 2011, 23:15 GMT
Comment by Greg (dolby) - Monday, 19
November 2012, 07:01 GMT
Can a mod edit this to add a Summary.
Please report upstream maybe suggesting to improve documentation
about this.