Issue
CONTEXT
I'm a Linux newbie and I've been exploring CentOs 7.
PROBLEM
I'm having troubles understanding where does Systemd keeps track of the enabled and disabled services.
You can pick as example httpd.
Where can I see if httpd is enabled or disabled without using systemctl status httpd? In which file this information can be found?
I have searched in /lib/systemd/system/httpd.service and also in /etc/httpd/conf/httpd.conf but didn't find something like enabled=no.
Solution
systemd doesn't maintain any "database" of disabled and enabled service. It just uses symlinks in target directories to determine whether service is enabled or not. E.g. when you enable service a symlink to systemd unit file is created in /etc/systemd/system/
target subdirectory (usually multi-user.target.wants
). Calling systemctl disable ...
just removes that symlink.
For system vendor shipped units it is a little more tricky as those symlinks aren't under your control (not sure if that is case of httpd
). To disable those services a symlink pointing to /dev/null
named as system service unit must be created in /etc/systemd/system/...
to "shadow" a real service link somewhere in /lib/systemd...
by higher priority faux link in /etc/systemd...
. I am not sure if just bare systemctl disable <vendor-unit>
does this.
Function of enable
and disable
is described here: https://www.freedesktop.org/software/systemd/man/systemctl.html#enable%20UNIT%E2%80%A6
Answered By - blami