Bug 517753 - RFE: Connect "@daily" and "@weekly" to anacron
RFE: Connect "@daily" and "@weekly" to anacron
Status: ASSIGNED
Product: Fedora
Classification: Fedora
Component: cronie (Show other bugs)
rawhide
All Linux
low Severity low
: ---
: ---
Assigned To: Tomas Mraz
Fedora Extras Quality Assurance
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-08-16 13:31 EDT by Tim Landscheidt
Modified: 2014-09-04 08:14 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Patch to add daily/weekly/monthly functionality to cron. (5.45 KB, patch)
2009-12-10 20:33 EST, Tim Landscheidt
no flags Details | Diff
Trigger to run daily cron jobs (to be put in /etc/cron.daily). (650 bytes, text/x-csrc)
2009-12-10 20:37 EST, Tim Landscheidt
no flags Details
Trigger to run weekly cron jobs (to be put in /etc/cron.daily). (651 bytes, text/x-csrc)
2009-12-10 20:39 EST, Tim Landscheidt
no flags Details
Trigger to run monthly cron jobs (to be put in /etc/cron.daily). (652 bytes, text/x-csrc)
2009-12-10 20:40 EST, Tim Landscheidt
no flags Details
Revised patch. (6.07 KB, patch)
2009-12-11 12:24 EST, Tim Landscheidt
no flags Details | Diff
Generic trigger (to be put in /usr/sbin). (1.09 KB, text/x-csrc)
2009-12-11 12:26 EST, Tim Landscheidt
no flags Details

  None (edit)
Description Tim Landscheidt 2009-08-16 13:31:03 EDT
At the moment, vixie-cron provides simple aliases "@daily", "@weekly", etc. for special points in time. If the daemon is not run at those times though, the actions are not executed. For system-wide crontabs, this can be worked around with anacron.

  For users, Fedora provides fcron as a replacement with a multitude of options. Fcron on the other hand has problems with SELinux and its configuration is generally harder to comprehend.

  It would therefore be very nice to connect vixie-cron's "@daily", "@weekly", etc. to anacron's schedule if anacron is installed and enabled (and otherwise default to the fixed points in time). This way, users who just want to ensure that some program is run "every day" could achieve that in a simple and convenient way.
Comment 1 Marcela Mašláňová 2009-08-17 04:53:46 EDT
That's good proposal. Though I'm not sure how easy (fast) will be implementing this feature.
Comment 2 Tim Landscheidt 2009-12-10 20:31:34 EST
I gave it a try and implemented a rough cut. As anacron is a prerequisite to cronie, it was easier than I thought.

  The patch adds a message receiver to cron that triggers jobs marked with @daily, @weekly or @monthly to be run. I kept the @midnight alias as meaning "midnight".

  The process is triggered by cron-{daily,weekly,monthly}.c that is put into /etc/cron.{daily,weekly,monthly}.

  To do:

1. Review messaging especially for security. My understanding is that the message queue is only accessible to root, but it would be nice if somebody could confirm that :-).
2. Package cron-{daily,weekly,monthly}.c correctly. My knowledge of automake & Co. is too shallow for that ATM.
3. Decide on a good file name for /etc/cron.{daily,weekly,monthly}/cron-{daily,weekly,monthly}. I do not consider the duplication very attractive.
4. Decide whether it is desirable to put binaries into /etc/cron.{daily,weekly,monthly} or instead have a /usr/bin/crontrigger that accepts "DAILY", "WEEKLY" and "MONTHLY" as argument and three small shell one-liners in /etc/cron.{daily,weekly,monthly} that call this program. I'm slightly inclined to the former as it is simpler.
Comment 3 Tim Landscheidt 2009-12-10 20:33:29 EST
Created attachment 377637 [details]
Patch to add daily/weekly/monthly functionality to cron.
Comment 4 Tim Landscheidt 2009-12-10 20:37:39 EST
Created attachment 377638 [details]
Trigger to run daily cron jobs (to be put in /etc/cron.daily).
Comment 5 Tim Landscheidt 2009-12-10 20:39:33 EST
Created attachment 377639 [details]
Trigger to run weekly cron jobs (to be put in /etc/cron.daily).
Comment 6 Tim Landscheidt 2009-12-10 20:40:51 EST
Created attachment 377640 [details]
Trigger to run monthly cron jobs (to be put in /etc/cron.daily).
Comment 7 Tomas Mraz 2009-12-11 03:13:48 EST
The security of the use of the message queue is probably OK. There might be some problems with SELinux labels especially in regards to MLS though however these might be solved later.

There should be definitely only one binary to send the messages, placed in the /usr/sbin directory.

The problem is what to do if the cronie-anacron is not installed. This should be probably solved just by the cronie-noanacron so the jobs are triggered from there. However it means that even without anacron the jobs would be no longer run at the times specified in the manual page so the manual page should be adjusted appropriately.

And there should be probably a new command line option for cron which would make it to disable the message queue receiver and schedule the jobs at the current fixed times.
Comment 8 Tim Landscheidt 2009-12-11 12:13:12 EST
(In reply to comment #7)
> [...]
> There should be definitely only one binary to send the messages, placed in the
> /usr/sbin directory.

I will post a short "crontrigger" later. I tried to include it in a patch/.spec, but patching only src/Makefile.ac didn't cut it, and I don't know which parts of autoconf/automake to run and files to compare to have a "meaningful" patch.

> The problem is what to do if the cronie-anacron is not installed. This should
> be probably solved just by the cronie-noanacron so the jobs are triggered from
> there. However it means that even without anacron the jobs would be no longer
> run at the times specified in the manual page so the manual page should be
> adjusted appropriately.

> And there should be probably a new command line option for cron which would
> make it to disable the message queue receiver and schedule the jobs at the
> current fixed times.  

As I'm still using F11, I didn't delve into that. In a revision of the original patch, I added an option "-a" that *enables* the interaction with anacron and made it the default via /etc/sysconfig/crond. If the option is not supplied or the message queue cannot be set up, it falls back to the old behaviour.

  configure.ac has to be amended to check for sys/msg.h. As per above, I don't know how to do that efficiently per .spec.
Comment 9 Tim Landscheidt 2009-12-11 12:24:14 EST
Created attachment 377767 [details]
Revised patch.

sys/msg.h has to be included in configure.ac and dependents.
Comment 10 Tim Landscheidt 2009-12-11 12:26:33 EST
Created attachment 377768 [details]
Generic trigger (to be put in /usr/sbin).
Comment 11 Fedora Admin XMLRPC Client 2014-09-04 08:14:57 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Note You need to log in before you can comment on or make changes to this bug.