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!
Try the systemd
mask
command rather thandisable
: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. Howevermask
disables the service completely.Also, I don't believe either
mask
ordisable
actually stop a running service: they just configure the startup of that service in the future. Therefore, you should also dosystemctl stop <service_name>
.