atop
atop copied to clipboard
cronjob to rotate file should be smarter
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
- the cronjob could be smarter, to check whether the date has changed (and then would need to run every minute?),
- 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),
- 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)
Would this be addressed as well with the changes in atop 2.7.0?
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.
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.