Red Hat Bugzilla – Bug 445174
There is a bad cron entry provided by atop
Last modified: 2012-05-09 17:06:52 EDT
Description of problem:
In /etc/cron.d/atop there is a reference to /etc/atop/atop.daily which is NOT
provided by the atop package. (It looks like /etc/cron.d/atop might not be
unnecessary as /etc/cron.daily/atop may be doing the same thing.)
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.yum install atop
2.Either look at the files directory or wait for the cron error message to be
Daily emails noting the problem with cron.
No daily emails about problems.
Indeed, /etc/cron.d/atop was superseded by /etc/cron.daily/atop and should no
longer be packaged.
Fixed in atop-1.23-7
Can you push this to bodhi? It hasn't been pushed out to Fedora 9 at least. I
don't know about other places.
Can someone reopen this bug?
It is still present in atop-1.23-10.fc12 and atop-1.23-8.el5
Thinking more about this, it's not ideal to have the cron job responsible for restarting atop in /etc/cron.daily. Scripts there are set to run at 4AM by default, but atop's raw log file reading functionality works best if the raw log file is rotated at midnight.
This is illustrated in the manpage: "A raw file can be read and visualized again with the flag -r followed by the filename... If a filename is specified in the format yyyymmdd (where yyyymmdd are digits representing any valid date), the file /var/log/atop/atop_yyyymmdd is opened."
One fix would be to move /etc/cron.daily/atop to somewhere like /usr/share/atop/restart_atop and have a file in /etc/cron.d that calls it at midnight. This is similar to what the sysstat package does.
Another approach might be to eliminate /etc/cron.daily/atop altogether. The only difference I see between it and /usr/bin/atopd is that atopd will restart atop or start atop if it isn't already running, while the cron job will only restart atop. This makes sense, since you don't want atop to be started by the cron job when you haven't started the atop service.
However, /etc/rc.d/init/atop has a working condrestart function that will execute /usr/bin/atopd only if /usr/bin/atop isn't already running. Using this from cron seems like a better approach then duplicating code between /usr/bin/atopd and /etc/cron.daily/atop.
Thus, my proposed fix to this bug is
1) Remove /etc/cron.daily/atop from the package
2) Change /etc/cron.d/atop to be
# start atop daily at midnight
0 0 * * * root /etc/rc.d/init.d/atop condrestart
This has the dual advantages of reducing code duplication and preserving the relationship between a raw log file's name and the day's data it contains.
I'm doing what I describe in comment 6 in my environment; you can see a puppet module for it at https://github.com/sciurus/puppet-atop.