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.
Edge Computing with AWS: CloudFront and Lambda@Edge
We use CloudFront + Lambda@Edge for specific patterns. The wins, the production gotchas, and where we hit Lambda@Edge's limits.
Systemd Service Management: Creating and Managing Services
A practical guide to writing and managing systemd services for production. The unit file features that earn their place, plus the operational workflows.
More from Linux
Explore more articles in this category
CERN Left Red Hat for Debian: The CPU Baseline Lesson
CERN is moving accelerator control computers to Debian because RHEL raised its minimum CPU level. Check your own fleet's x86-64-vN support before the next OS upgrade does it for you.
ext4 vs XFS vs Btrfs: Choosing a Filesystem for a Server
The default filesystem your distro picks is not always the right one for your workload. Here is what actually differs and when each one wins.
journald Log Management: Retention, Filtering, and Forwarding
journald is the default log sink on every systemd distro, and most of it runs on defaults nobody chose. Here is how to actually control it.
You might have missed
Evergreen posts worth revisiting.