Subject: ..fix: atop installs systemd cron job on non-systemd Devuan box, was: Bug#913364: real bug, too low severity

From: Arnt Karlsen <[email-masked]>
Date: Mon, 11 Mar 2019 11:05:28 +0100

On Thu, 22 Nov 2018 02:15:59 +0100, Arnt wrote in message 
<20181122021559.60f6ac16@d44>:
> 
> ..which part of:" # daily restart of atop at midnight
> 0 0 * * * root if [ -d "/run/systemd/system" ]; then systemctl \
> restart atop; else /usr/share/atop/atop.daily \& ; fi" "on a
> non-systemd box" did you miss?

[...]

> ..this bug is insisting on assuming systemctl etc systemd commands 
> and totally disregarding the fact some of us throw out junk "init"
> binaries and move on with ye aulde relics that just works, and fix 
> atop in https://bugs.devuan.org//cgi/bugreport.cgi?bug=262 when we 
> get such clear wont-fix hints in Message #15. 
> 
> ..if you Debian etc systemd guys _do_ wanna fix your #913364, put 
> back in the test for systemd and install atop.cronsystemd if you 
> find systemd on your boxes, and give the rest of us back our 
> beloved atop.cronsysv.  Etc.  Easily found in your well documented 
> $favorite_mirror/debian/pool/main/a/atop/atop_*tar* balls.

..instead you test for systemd every damned time cron runs atop...:
cat /etc/cron.d/atop:"
PATH=/bin:/usr/bin:/sbin:/usr/sbin

# daily restart of atop at midnight
0 0 * * * root if [ -d "/run/systemd/system" ]; then systemctl
restart atop; else /usr/share/atop/atop.daily \& ; fi "

...when that test should happen once, everytime atop is upgraded to 
a new version, or reinstalled, or downgraded to a known good working
version etc, to _decide_which_version_ /etc/cron.d/atop to install,
either /etc/cron.d/atop.sysv _OR_ /etc/cron.d/atop.systemd.

..my _fixed_ /etc/cron.d/atop for non-systemd Devuan etc boxes...:"
PATH=/bin:/usr/bin:/sbin:/usr/sbin

# daily restart of atop at midnight
0 0 * * * root /usr/share/atop/atop.daily \& "

...works nicely enough to warrant closing this bug.

..I would _guess_  an /etc/cron.d/atop like ...: "
PATH=/bin:/usr/bin:/sbin:/usr/sbin

# daily restart of atop at midnight
0 0 * * * root systemctl restart atop \& "

...would work for systemd boxes.

-- 
..med vennlig hilsen = with Kind Regards from Arnt Karlsen
...with a number of polar bear hunters in his ancestry...
  Scenarios always come in sets of three: 
  best case, worst case, and just in case.