← Back to Blog
DevOps August 7, 2026

Stop Manually Restarting Services at 3 AM

🔧 Daily DevOps Tip — August 7, 2026

Stop Manually Restarting Services at 3 AM

The problem: Your service crashes at 3 AM. Restart=no is the systemd default — so it stays crashed until morning.

The fix — 3 lines in every .service file:
Restart=on-failure
RestartSec=5s
WatchdogSec=30s


Why it works:
  • Restart=on-failure → auto-restart on non-zero exit

  • RestartSec=5s → prevents crash-loop cascades (default is 100ms)

  • WatchdogSec=30s → kills the service if it doesn't check in


Bonus — fix the rate limiter (default: 5 failures/10s):
StartLimitBurst=10
StartLimitIntervalSec=120


3 AM triage when it does fail:
systemctl status myservice
journalctl -u myservice --since "1 hour ago"
systemctl reset-failed && systemctl start myservice


💡 Pro tip: Add ExecStartPre=/usr/bin/test -f /var/lib/myapp/ready to prevent starting into a broken state.