systemd: units, systemctl and managing services
Sign in to read this lesson
nginx, ssh, the database — they are all services managed by systemd. In this lesson we learn to start and stop a service, start it automatically at boot, find out why it failed, turn our own script into a service, and use timers, the modern replacement for cron.
What you will learn
- In systemd everything is a unit:
.service(a service),.timer(a schedule),.mount,.target(a group). systemctl start/stop/restart/reloadact now,enable/disableact at boot;enable --nowdoes both.systemctl status nameandjournalctl -u name -eshow why a service failed;systemctl --failedlists failed units.- Your own service lives in
/etc/systemd/system/name.service; after changing it, runsudo systemctl daemon-reload. - Do not edit a package's file: create an override with
sudo systemctl edit name.
The lesson has 5 key points, an explanation and 5 questions. It opens with a package.