7

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 the enable 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.

  • 1
    All "combinations" work fine here (archlinux). – don_crissti Jun 29 '17 at 20:57
6

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.

  • 1
    FYI I am on CentOS 7 and # systemctl --version tells me I'm using systemd 219 but I have verified that the --now flag indeed starts a stopped service. Maybe RHEL/CentOS backporting? – pzkpfw Mar 6 at 15:59
  • Hi @pzkpfw same for me, even I am on 219 and --now works for me. – Prashant Lakhera Mar 24 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy