The Free Encyclopedia

Understanding systemd

systemd is the first process Linux starts (PID 1) and the manager for every service after it. If something runs in the background on a modern Linux box, systemd is supervising it.

The essentials

systemctl status nginx        # is it running? recent logs
systemctl start|stop|restart nginx
systemctl enable --now nginx  # start now + on every boot
journalctl -u nginx -f        # live logs for a service

A unit file

/etc/systemd/system/myapp.service:

[Unit]
Description=My App
After=network-online.target

[Service]
ExecStart=/usr/bin/myapp
Restart=always
User=appuser

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload && sudo systemctl enable --now myapp

System vs user services

Scope Command Runs
System systemctl At boot, as root/specified user
User systemctl --user When the user is logged in…

User services need lingering (loginctl enable-linger user) to survive logout — a classic gotcha. See Building MCP Servers as systemd User Services.

Related: The Linux Boot Process · Cron and Scheduling · Building MCP Servers as systemd User Services

Categories: Linux and Sysadmin