systemd
Systemd units are tools that manage resources and services. A unit for an apache2 service will be apache2.service
.
Unit Types
service
→ Most common one, for system resources that can be initiated, interrupted and reloaded.socket
→ Filesystem or a network socket. They have a corresponding service unit loaded when the socket receives a request.device
→ Associated with a hardware device. udev rule for the purpose must exist.mount
→ Mount point definition in the filesystem, similar to/etc/fstab
.automount
→ Same as above, but mounted automatically. Has a corresponding mount unit, initiated when automount is accessed.target
→ Grouping of other units managed as a single unit.snapshot
→ Saved state of the systemd manager.
Important info
- Unit location configuration:
/usr/lib/systemd/system
- Remember to run
systemctl daemon-reload
after editing some configuration.
Common actions
systemctl start <unit_name>.service
systemctl stop <unit_name>.service
systemctl restart <unit_name>.service
systemctl status <unit_name>.service
systemctl is-active <unit_name>.service
systemctl enable <unit_name>.service
systemctl disable <unit_name>.service
systemctl is-enabled <unit_name>.service
systemctl get-default
→ gets the default boot target.systemctl list-units
→ lists active units.systemctl list-unit-files
→ lists all units.
Unless specified otherwise, this work is licensed under a Creative Commons BY-NC-SA 4.0.