Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 503666 - sys-process/cronie[anacron] doesn't install anacron properly
Summary: sys-process/cronie[anacron] doesn't install anacron properly
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Lars Wendler (Polynomial-C)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-06 21:03 UTC by Matthew Schultz
Modified: 2015-01-27 10:26 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Schultz 2014-03-06 21:03:37 UTC
There are several issues with how anacron is installed which will cause it to not work as intended:

1. /etc/init.d/anacron init script is not a daemon.  It is meant to be executed once upon boot and exit.  The script runs anacron properly but incorrectly reports its status as "crashed" when it should report itself as "stopped" because it does not continue to run in the background as a daemon after it has executed.

2. The cronie-1.2-crontab file that the ebuild installs is not modified when anacron is installed as well.  When anacron is installed, it should take over the process of running the cron.daily, cron.weekly and cron.monthly scripts as documented in the package crontab file which is specifically prefixing the daily, weekly and monthly commands with this: [ ! -f /etc/cron.hourly/0anacron ] -- taken from dailyjobs file in the package.

3. /etc/cron.hourly/0anacron should always be installed as executable because that script takes over the duties of running daily, weekly and monthly scripts instead of the main crontab.



Reproducible: Always
Comment 1 Lars Wendler (Polynomial-C) gentoo-dev 2014-03-30 11:41:01 UTC
+*cronie-1.4.11-r2 (30 Mar 2014)
+
+  30 Mar 2014; Lars Wendler <polynomial-c@gentoo.org> +cronie-1.4.11-r2.ebuild,
+  +files/cronie-1.3-crontab:
+  Attempt to fix installation of anacron as suggested by Matthew Schultz in bug
+  #503666.
+

Alright... I've tried to address all your suggestions. Please give cronie-1.4.11-r2 a try and report back if all your concerns are fixed.
Any further suggestions to anacron are welcome.
Comment 2 Philipp Riegger 2014-04-18 13:08:49 UTC
I think, there's room for improvement:

1) As I mentioned in (bug 503634):

In case it should only be run if the user explicitly sets it to be executable, maybe the test in /etc/crontab which is at the moment

[ ! -f /etc/cron.hourly/0anacron ]

should be set to

[ ! -x /etc/cron.hourly/0anacron ]

2) My crontab says:

[ ! -f /etc/cron.hourly/0anacron ] && rm -f /var/spool/cron/lastrun/cron.hourly

Who is executing /etc/cron.hourly/0anacron then?
Comment 3 Lars Wendler (Polynomial-C) gentoo-dev 2014-04-18 13:25:12 UTC
+*cronie-1.4.11-r3 (18 Apr 2014)
+
+  18 Apr 2014; Lars Wendler <polynomial-c@gentoo.org> -cronie-1.4.11-r2.ebuild,
+  +cronie-1.4.11-r3.ebuild, files/cronie-1.3-crontab:
+  Only use anachron if 0anacron is executable.
+

Please test and report back if that fixes all your concerns.
Comment 4 Philipp Riegger 2014-04-28 12:56:10 UTC
I'm not 100% sure how anacron is supposed to work, so you might want to double-check my suggestion.

- As fas as I understand, anacron calls scripts in cron.daily, cron.weekly and cron.monthly. It does _not_ call scripts in cron.hourly.
- Anacron itself is called by a script in cron.hourly.

Therefore the check for /etc/cron.hourly/0anacron should _not_ be in front of the cron.hourly rm call and in front of the run-crons command. I've been using cronie with anacron and those 2 changes for more than a week now and it seems to work as expected.
Comment 5 nebojsa 2015-01-27 10:26:36 UTC
As it is as of sys-process/cronie-1.4.12, configuration when using anacron is wrong - no jobs under hourly, daily, weekly or monthly gets ever executed.
In cronie, anacron is only using external invocation or through cron jobs.

Working configuration for /etc/crontab, when using anacron:
01 * * * * root run-parts /etc/cron.hourly

Maybe we should consider making anacron mandatory with cronie, because it has built in job serialization and locking, and remove /usr/sbin/run-crons, which tries to do precisely same job.