26

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
  • 2
    All "combinations" work fine here (archlinux). Commented Jun 29, 2017 at 20:57

1 Answer 1

30

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.

2
  • 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
    Commented Mar 6, 2019 at 15:59
  • 1
    Hi @pzkpfw same for me, even I am on 219 and --now works for me. Commented Mar 24, 2019 at 17:05

You must log in to answer this question.