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: red.ht/2YCMEQl

Origin of this instruction: 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.

No Comments Yet