Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot disable systemd service

I've been using the dbus API from systemd and I've been enabling services with the EnableUnitFiles() function as detailed here http://www.freedesktop.org/wiki/Software/systemd/dbus/

However, when I try to disable the same service with the command

systemctl disable "service_name"

and follow-up with a check to see if the service is disabled with

systemctl status "service_name"

it still reveals the service to be enabled. I am currently running Centos7.

Any insight would be appreciated as to why I cannot disable the service. Thanks!

like image 678
Andy Kim Avatar asked Jun 08 '15 23:06

Andy Kim


1 Answers

Try the systemd mask command rather than disable:

systemctl mask <service_name>

The disable command still allows the service to be started, for example, in response to another service requesting it as a dependency (even if optional), or manually. However mask disables the service completely.

Also, I don't believe either mask or disable actually stop a running service: they just configure the startup of that service in the future. Therefore, you should also do systemctl stop <service_name>.

like image 141
Raman Avatar answered Sep 20 '22 04:09

Raman