Bug 445174 - There is a bad cron entry provided by atop
There is a bad cron entry provided by atop
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: atop (Show other bugs)
rawhide
All Linux
low Severity low
: ---
: ---
Assigned To: Kairo Araujo
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-05-05 02:16 EDT by Bruno Wolff III
Modified: 2012-05-09 17:06 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-05-06 12:43:09 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Bruno Wolff III 2008-05-05 02:16:19 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):
1.23-6.fc9

How reproducible:
100%

Steps to Reproduce:
1.yum install atop
2.Either look at the files directory or wait for the cron error message to be
mailed.
3.
  
Actual results:
Daily emails noting the problem with cron.

Expected results:
No daily emails about problems.

Additional info:
Comment 1 manuel wolfshant 2008-05-05 03:29:38 EDT
Indeed, /etc/cron.d/atop was superseded by /etc/cron.daily/atop and should no
longer be packaged.
Comment 2 Kairo Araujo 2008-05-05 17:00:05 EDT
Fixed in atop-1.23-7
Comment 3 Bruno Wolff III 2008-05-14 13:41:59 EDT
Can you push this to bodhi? It hasn't been pushed out to Fedora 9 at least. I
don't know about other places.
Comment 4 Brian Pitts 2010-06-28 12:08:25 EDT
Can someone reopen this bug?

It is still present in atop-1.23-10.fc12 and atop-1.23-8.el5
Comment 5 Brian Pitts 2010-06-29 11:34:57 EDT
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.
Comment 6 Brian Pitts 2010-06-29 12:13:37 EDT
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.
Comment 7 Brian Pitts 2012-05-09 17:06:52 EDT
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.

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