Working with systemd units

Add new systemd service (will symlink your file):

sudo systemctl enable /full/path/to/service-name.service

Remove existing systemd service (will remove symlinked files):

sudo systemctl disable service-name[.mount]

Reload after changing your symlinked systemd service:

sudo systemctl daemon-reload

Start/stop systemd service:

sudo systemctl start service-name
sudo systemctl stop service-name

Try again starting up failed services (mark them not failed):

sudo systemctl reset-failed [optional service-name]

Check status of a unit:

sudo systemctl status service-name[.mount]

Follow log of a unit:

journalctl -u service-name -f

View contents of a systemd unit file:

systemctl cat service-name[.mount]

Code snippets in this post are covered by MIT License.



Date
December 6, 2022