Skip to main content

Auto-restart Crashed Systemd Service

Updated 0 min readMarkdown
Auto-restart Crashed Systemd Service

Systemd is a system and service manager for Linux operating systems. It is designed to be backward compatible with SysV init scripts, and provides a number of features such as parallel startup of system services at boot time, on-demand activation of daemons, or dependency-based service control logic.

Systemd Guide: https://red.ht/2YCMEQl

Origin of this instruction: https://bit.ly/2YJ36hQ

TL;DR

[Unit]
Description=Your Daemon
After=network-online.target
Wants=network-online.target systemd-networkd-wait-online.service

StartLimitIntervalSec=500
StartLimitBurst=5

[Service]
Restart=on-failure
RestartSec=5s

ExecStart=/path/to/daemon

[Install]
WantedBy=multi-user.target

Set StartLimitIntervalSec, StartLimitBurst, Restart, and RestartSec.

91 views

About the author

  • I work with Linux in the day, ballroom dancing at night. I use Arch, btw.

No comments yet. Be the first to comment.

More from this blog