21

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.

Martin Schröder
  • 939
  • 1
  • 10
  • 35

1 Answers1

26

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.

David Birks
  • 440
  • 5
  • 6
  • 2
    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 06 '19 at 15:59
  • 1
    Hi @pzkpfw same for me, even I am on 219 and --now works for me. – Prashant Lakhera Mar 24 '19 at 17:05