Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@daily @hourly etc not run #15

Open
lilydjwg opened this issue May 2, 2018 · 4 comments · May be fixed by #35
Open

@daily @hourly etc not run #15

lilydjwg opened this issue May 2, 2018 · 4 comments · May be fixed by #35

Comments

@lilydjwg
Copy link

lilydjwg commented May 2, 2018

After merging of #3, my @daily @hourly etc jobs are not run. I've reverted back to 6186237 and they are run again.

@ben-warrington
Copy link

I can confirm this is still an issue 3 years later.

@ScrumpyJack
Copy link

Would be nice to see support for these. as well as @reboot

@henri62
Copy link

henri62 commented Feb 24, 2022

The problem is that the manual mentions the options but they do not work:

As a workaround add something like this in your system crontab file:

# SYSTEM HOURLY/DAILY/WEEKLY/MONTHLY FOLDERS
0 * * * * /bin/run-parts /etc/cron.hourly
0 3 * * * /bin/run-parts /etc/cron.daily
15 4 * * 6 /bin/run-parts /etc/cron.weekly
30 5 1 * * /bin/run-parts /etc/cron.monthly

@jensrenner1980
Copy link

jensrenner1980 commented May 9, 2022

The issue is that for aliases like @hourly, @daily, etc. any point in time (minute, hour, day of month, month: * * * * ) will be allowed for processing in SynchronizeFile() (database.c:448) and the actual execution of the job only depends on the "frequency" (i.e. 60x60 for hourly, 24x60x60 for daily, etc.).
Initialization for day-of-week (dow) though, is apparently missing!
In TestJobs() (database:1032) and ArmJob() (database.c:1105) there is a check that involves day-of-week that consequently fails, so the job will never be run.
(Additional debug output by me.)

cron.debug crond[21448]: Synchronizing /etc/cron.d
cron.debug crond[21448]: User root Entry @hourly ID=sys-hourly /bin/run-parts /etc/cron.hourly
cron.debug crond[21448]: Command /bin/run-parts /etc/cron.hourly Job sys-hourly
cron.debug crond[21448]: SynchronizeFile():
cron.debug crond[21448]: CronLine: ------------
cron.debug crond[21448]: Command: /bin/run-parts /etc/cron.hourly
cron.debug crond[21448]: Freq: 3600 (seconds)
cron.debug crond[21448]: Delay: 180
cron.debug crond[21448]: PID: 0
cron.debug crond[21448]: Mins: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
cron.debug crond[21448]: Hrs: xxxxxxxxxxxxxxxxxxxxxxxx
cron.debug crond[21448]: Days: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
cron.debug crond[21448]: Mons: xxxxxxxxxxxx
cron.debug crond[21448]: Dow: 00 00 00 00 00 00 00
[...]
cron.debug crond[21448]: TestStartup for FILE /etc/cron.d/system USER root:
cron.debug crond[21448]: LINE /bin/run-parts /etc/cron.hourly JOB sys-hourly
cron.debug crond[21448]: LINE /bin/run-parts /etc/cron.daily JOB sys-daily
cron.debug crond[21448]: LINE /bin/run-parts /etc/cron.weekly JOB sys-weekly
cron.debug crond[21448]: LINE /bin/run-parts /etc/cron.monthly JOB sys-monthly
cron.debug crond[21448]: Wakeup dt=33
cron.debug crond[21448]: TestJobs() database.c:976
cron.debug crond[21448]: Wakeup dt=60
cron.debug crond[21448]: TestJobs() database.c:976
cron.debug crond[21448]: Wakeup dt=60
cron.debug crond[21448]: TestJobs() database.c:976
[...]

To make the aliases work, I added the following two lines to SynchronizeFile() (database.c:458):
for (j=0; j<7; ++j)
line.cl_Dow[j] = ALL_DOW;

dcron.patch.txt

Then the debug messages look like:
cron.debug crond[21448]: Synchronizing /etc/cron.d
cron.debug crond[21448]: User root Entry @hourly ID=sys-hourly /bin/run-parts /etc/cron.hourly
cron.debug crond[21448]: Command /bin/run-parts /etc/cron.hourly Job sys-hourly
cron.debug crond[21448]: SynchronizeFile():
cron.debug crond[21448]: CronLine: ------------
cron.debug crond[21448]: Command: /bin/run-parts /etc/cron.hourly
cron.debug crond[21448]: Freq: 3600 (seconds)
cron.debug crond[21448]: Delay: 180
cron.debug crond[21448]: PID: 0
cron.debug crond[21448]: Mins: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
cron.debug crond[21448]: Hrs: xxxxxxxxxxxxxxxxxxxxxxxx
cron.debug crond[21448]: Days: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
cron.debug crond[21448]: Mons: xxxxxxxxxxxx
cron.debug crond[21448]: Dow: 3f 3f 3f 3f 3f 3f 3f
[...]
cron.debug crond[21448]: TestStartup for FILE /etc/cron.d/system USER root:
cron.debug crond[21448]: LINE /bin/run-parts /etc/cron.hourly JOB sys-hourly
cron.debug crond[21448]: LINE /bin/run-parts /etc/cron.daily JOB sys-daily
cron.debug crond[21448]: LINE /bin/run-parts /etc/cron.weekly JOB sys-weekly
cron.debug crond[21448]: LINE /bin/run-parts /etc/cron.monthly JOB sys-monthly
cron.debug crond[6802]: Wakeup dt=50
cron.debug crond[6802]: TestJobs() database.c:976
cron.debug crond[6802]: Wakeup dt=60
cron.debug crond[6802]: TestJobs() database.c:976
cron.debug crond[6802]: Wakeup dt=60
cron.debug crond[6802]: TestJobs() database.c:976
cron.debug crond[6802]: ArmJob(): sys-hourly
cron.debug crond[6802]: scheduled: user root job sys-hourly
cron.debug crond[6802]: RunJobs(): sys-hourly
cron.info crond[6802]: FILE /etc/cron.d/system USER root PID 7772 job sys-hourly
cron.debug crond[6802]: RunJobs(): sys-daily
cron.debug crond[6802]: RunJobs(): sys-weekly
cron.debug crond[6802]: RunJobs(): sys-monthly
cron.debug crond[9198]: child running: job sys-hourly
cron.debug crond[6802]: exit status 0 from user root job sys-hourly
[...]

But @henri62's workaround (explicitely using time tables instead of aliases) will certainly do.

hamarituc added a commit to hamarituc/dcron that referenced this issue Sep 2, 2022
closes dubiousjim#15

Signed-off-by: Mario Haustein <[email protected]>
@hamarituc hamarituc linked a pull request Sep 2, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants