Przejdź do treści

⚙️ systemd (Extended)

systemd is the service manager used in modern Linux systems. It controls services, startup processes and system tasks.


🔧 Managing Services

1
2
3
4
5
6
systemctl status <service>
systemctl start <service>
systemctl stop <service>
systemctl restart <service>
systemctl enable <service>
systemctl disable <service>

🧩 Unit File Structure

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
[Unit]
Description=My Custom Service
After=network.target

[Service]
ExecStart=/usr/local/bin/myapp
Restart=always
User=www-data
WorkingDirectory=/opt/myapp

[Install]
WantedBy=multi-user.target

🛠️ Reloading systemd

1
sudo systemctl daemon-reload

🔍 Debugging Services

1
2
journalctl -u <service> -xe
systemctl status <service>

🚨 Common Issues

  • Wrong ExecStart path
  • Missing permissions
  • Service not enabled
  • Syntax errors in unit file