Reload a unit file after editing
Reload unit files and restart the service
systemctl daemon-reload && systemctl restart myapp.service
More systemd commands
-
systemctl edit myapp.serviceOpen /etc/systemd/system/myapp.service.d/override.conf in an editor for partial overrides
-
systemctl cat myapp.servicePrint the full unit file, including drop-ins
-
systemd-analyze blame | head -20Show the 20 units that took the longest to start
-
systemd-analyze dot --require | dot -Tsvg > boot.svg && open boot.svgRender the boot dependency graph as SVG and open it
-
cat > /etc/systemd/system/myapp.service <<EOF [Unit] Description=My App After=network.target [Service] ExecStart=/usr/bin/myapp Restart=always RestartSec=5 User=appuser [Install] WantedBy=multi-user.target EOFMinimal service unit template with automatic restart