Kennisbank

How to Manage Services with systemd on Ubuntu

systemd controls services (daemons) on Ubuntu. Use systemctl to start, stop and monitor them.

Common service commands

sudo systemctl start nginx     # start now
sudo systemctl stop nginx      # stop now
sudo systemctl restart nginx   # restart
sudo systemctl reload nginx    # reload config without downtime
sudo systemctl status nginx    # check status

Enable services at boot

sudo systemctl enable nginx    # start automatically at boot
sudo systemctl disable nginx   # don't start at boot
sudo systemctl enable --now nginx   # enable + start together

Viewing logs

journalctl -u nginx           # logs for a service
journalctl -u nginx -f        # follow live
journalctl -xe                # recent errors

Use systemctl list-units --type=service to see all running services.

Was dit antwoord nuttig?

0 gebruikers vonden dit artikel nuttig

Powered by WHMCompleteSolution