Systemd and Modern Linux Service Management
Run services reliably with systemd: units, dependencies, and resource limits.
On this page
Systemd is the standard for service management on most Linux distros. Use it for reliability and observability.
Unit Basics
[Unit]
Description=My App
After=network-online.target
Wants=network-online.target
[Service]
Type=exec
ExecStart=/usr/local/bin/myapp
Restart=on-failure
RestartSec=5
User=app
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
Best Practices
- Restart=on-failure with RestartSec to avoid tight restart loops.
- User= non-root; use CapabilityBoundingSet and NoNewPrivileges when possible.
- LimitNOFILE, LimitNPROC to avoid resource exhaustion.
- After=network-online.target so the app starts when the network is ready.
Logging
- journald: Use StandardOutput=journal and StandardError=journal; query with journalctl -u myapp -f.
Systemd gives you a consistent way to run and debug services across environments.
Cite this article
Kiril Urbonas (2025). Systemd and Modern Linux Service Management. DevOpsNess. https://www.devopsness.com/blog/systemd-and-modern-linux-service-management
[Systemd and Modern Linux Service Management](https://www.devopsness.com/blog/systemd-and-modern-linux-service-management) (Kiril Urbonas, DevOpsNess, 2025-12-13)
More from Linux
Explore more articles in this category
Container Resource Limits: What They Actually Do at the Kernel Level
cpu.weight vs cpu.max vs memory.max: the cgroup mechanics behind Kubernetes resource limits, and the surprises that explain the weird symptoms you've seen.
Process Management and Monitoring in Linux
How processes actually live and die on Linux, the tools that show what's happening, and the patterns we use for monitoring service health.
zram vs zswap: Compress Linux Memory Before You Buy More RAM
Both compress memory in RAM, but zram replaces your swap device and zswap sits in front of one. On a server with a disk, that difference decides which one you want.
You might have missed
Evergreen posts worth revisiting.