atop icon indicating copy to clipboard operation
atop copied to clipboard

cronjob to rotate file should be smarter

Open Zugschlus opened this issue 7 years ago • 3 comments

Hi,

this is me forwarding https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=848708

When using "atop" on a machine that's not running 24/7, the cronjob at 00:00 is not run more often than not (depending on your usage pattern, of course ;). This makes some use of "atop" harder than necessary; "atop -r y" doesn't work, you'll need the right amount of "y"esterdays to find the right file.

So, either

  1. the cronjob could be smarter, to check whether the date has changed (and then would need to run every minute?),
  2. or "atop" could be handling that (just open the file for every write, ie. by default every 600 seconds, with the correct path newly calculated),
  3. or things like suspend/resume could signal atop to start a new file.

I guess option 2 would be the easiest one to implement, and the most likely to be correct.

Thank you for your consideration!

(thanks to Ph Marek for filing this)

Zugschlus avatar Nov 17 '17 14:11 Zugschlus

Would this be addressed as well with the changes in atop 2.7.0?

Zugschlus avatar Dec 19 '21 19:12 Zugschlus

I guess this issue is already solved by earlier modifications, using a systems timer instead of cron. The atop-rotate.timer takes care that atop-rotate.service is started at midnight (OnCalendar=daily) for systems that run 24/7. The atop-rotate.service restarts the atop.service, terminating the current atop running in the background and starting a new atop creating a new daily file with the actual date. For system that are not running 24/7 atop.service is activated during boot. Also in that case atop creates a new daily file with the actual date.

Atoptool avatar Apr 24 '22 09:04 Atoptool

Thanks for pulling this back to my attention. I have reached out to the original bug reporter, asking them whether the issue is still present in current atop. I will close the Debian bug according to their answer or by the end of July 2022, whatever happens first. Feel free to close this here earlier, but maybe it would be wise to close both reports simultaneously.

Zugschlus avatar Apr 24 '22 11:04 Zugschlus