systemd

Published: Tuesday, Jan 1, 2013 Last modified: Saturday, Mar 23, 2024

On Archlinux, /etc/systemd/system/ takes precedence over /usr/lib/systemd/system/.

System: /usr/lib/systemd/system/

x220:~$ ls /usr/lib/systemd/system/ | grep rsync
rsyncd.service
rsyncd@.service
rsyncd.socket
x220:~$ systemctl list-unit-files | grep rsync
rsyncd.service                          disabled
rsyncd@.service                         static
rsyncd.socket                           disabled

Your system wide systemd stuff: /etc/systemd/system/

x220:/etc/systemd/system$ tree
.
├── autologin@.service
├── conn.service
├── foobar.service
├── getty.target.wants
│   └── getty@tty1.service -> /etc/systemd/system/autologin@.service
├── local-fs.target.wants
├── multi-user.target.wants
│   ├── conn.service -> /etc/systemd/system/conn.service
│   ├── dcron.service -> /usr/lib/systemd/system/dcron.service
│   ├── httpd.service -> /usr/lib/systemd/system/httpd.service
│   ├── ntpd.service -> /usr/lib/systemd/system/ntpd.service
│   ├── remote-fs.target -> /usr/lib/systemd/system/remote-fs.target
│   ├── sshd.service -> /usr/lib/systemd/system/sshd.service
│   ├── syslog-ng.service -> /usr/lib/systemd/system/syslog-ng.service
│   └── vboxservice.service -> /usr/lib/systemd/system/vboxservice.service
├── network.service
├── sysinit.target.wants
└── syslog.service -> /usr/lib/systemd/system/syslog-ng.service

4 directories, 14 files

Enabling and disabling a service

$ sudo systemctl disable network
rm '/etc/systemd/system/multi-user.target.wants/network.service'

/etc/systemd/system$ sudo systemctl enable conn
ln -s '/etc/systemd/system/conn.service' '/etc/systemd/system/multi-user.target.wants/conn.service'

Symlinks to /etc/systemd/system/multi-user.target.wants.

So listing the contents of /etc/systemd/system/multi-user.target.wants shows basically what a user wants to startup.

Listing /etc/systemd/system/

If you have a /etc/systemd/system/foobar.service present:

$ systemctl list-units | grep foo
$ systemctl list-unit-files | grep foo
foobar.service                          disabled