0

I am on CentOS 7 and using atop v2.6.0

If I run atop manually with the following command everything runs as expected and the log is written to every 10 seconds:

/usr/bin/atop -w /var/log/atop/atop_20210320 10

However when running atop as a service with systemd the log is only written to once when the service starts and never updated.

I can confirm via ps -ef that the service has initiated the command and it's running:

root 2320 1 0 13:34 ? 00:00:00 /usr/bin/atop -w /var/log/atop/atop_20210320 10

Any help would be much appreciated. Thank you.

Pel
  • 1
  • 1
  • I don’t think you’re supposed to invoke `atop -w` directly from systemd. On my system I see a `atop.service` unit already configured to invoke `atop.daily`, which takes care of running `atop -w`, and a cron job that restarts it daily at midnight. I suggest you check the documentation for your atop package for how to enable those in Centos. – Amir Mar 22 '21 at 11:16
  • Thanks, Amir but I am in fact using the package installed atop service (i.e., systemctl start atop) and after going through its various shell script processes the command that the service actually runs is "/usr/bin/atop -w /var/log/atop/atop_20210320 10" but since the service was failing after one run, I tried running that command manually and found that it ran just fine and the log was written to every 10 seconds as expected. So for some reason, the default atop service isn't working even though there doesn't appear to be an issue with the command it ultimate initiates. – Pel Mar 22 '21 at 18:08

1 Answers1

0

Make sure atop-rotate.timer is enabled and you'll have daily logs:

# systemctl enable --now atop-rotate.timer
# systemctl status atop-rotate.timer
amized
  • 501
  • 4
  • 3