the --now switch of `systemctl`
I've found that annoying as well.
Looks like the --now
switch was added in version 220 (see this line in the changelog), and CentOS 7 is currently on version 219. Hopefully soon then!
You can check your version of systemd with systemctl --version
.
Related videos on Youtube
Martin Schröder
Updated on September 18, 2022Comments
-
Martin Schröder over 1 year
As stated in the man page,
systemctl --now enable servicename
should enable and start the service.
But it never works for me, under many different distributions.
While the output of:
systemctl is-enabled
turns enabled,systemctl is-active
is still inactive for the service.What this switch is good for?
I've tried other combinations such as:
systemctl enable --now servicename
and:
systemctl enable servicename --now
but still the same; I have to manually
systemctl start servicename
every time, even if the previous command (ie theenable
part) executes successfully.Is it that the application's implentation of systemd service should support it implementing the feature somewhere in the unit files; what many well-known services do not follow, that made me think its entirely useless switch; I assume thinking over it.
-
Admin almost 7 yearsAll "combinations" work fine here (archlinux).
-
-
pzkpfw about 5 yearsFYI I am on CentOS 7 and
# systemctl --version
tells me I'm usingsystemd 219
but I have verified that the--now
flag indeed starts a stopped service. Maybe RHEL/CentOS backporting? -
Prashant Lakhera about 5 yearsHi @pzkpfw same for me, even I am on 219 and --now works for me.