Incorrect test used for anacron being active
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cron (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
/etc/crontab uses
test -x /usr/sbin/anacron
for whether anacron is handling the daily/weekly/
This means that if anacron is installed it is assumed to be running.
However, this is a service, and can be disabled and since the package is installed by default it's simpler to just disable it on systems where you don't want it running rather then remove it.
Changing the test to be:
systemctl --no-pager is-enabled anacron 2>/dev/null
(and changing the || to be &&, since the login is now reversed) caters for either case by checking what you really wish to know - is it active, not just installed.
ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: cron 3.0pl1-128ubuntu5
ProcVersionSign
Uname: Linux 4.13.0-37-generic x86_64
ApportVersion: 2.20.7-0ubuntu3.7
Architecture: amd64
CurrentDesktop: KDE
Date: Thu Mar 29 13:33:47 2018
InstallationDate: Installed on 2017-11-01 (147 days ago)
InstallationMedia: Kubuntu 17.10 "Artful Aardvark" - Release amd64 (20171017.1)
SourcePackage: cron
UpgradeStatus: No upgrade log present (probably fresh install)
Actually
systemctl -q is-enabled anacron 2>/dev/null
works to, and is shorter (and more intuitive).