From ff982cd1c3af23dd69a7878fb805f024c18f40eb Mon Sep 17 00:00:00 2001 From: "fox.cpp" Date: Fri, 27 Dec 2019 18:00:13 +0300 Subject: [PATCH] dist: Use Restart=on-failure in systemd units With RestartPreventExitStatus to prevent restart spam on configuration errors. --- dist/systemd/maddy.service | 5 ++++- dist/systemd/maddy@.service | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dist/systemd/maddy.service b/dist/systemd/maddy.service index f1f93d5..069fdb1 100644 --- a/dist/systemd/maddy.service +++ b/dist/systemd/maddy.service @@ -68,6 +68,9 @@ LimitNOFILE=131072 # processes launched. LimitNPROC=512 -Restart=on-abnormal +# Restart server on any problem. +Restart=on-failure +# ... Unless it is a configuration problem. +RestartPreventExitStatus=2 ExecStart=/usr/bin/maddy diff --git a/dist/systemd/maddy@.service b/dist/systemd/maddy@.service index 704147f..31c47b0 100644 --- a/dist/systemd/maddy@.service +++ b/dist/systemd/maddy@.service @@ -62,6 +62,9 @@ LimitNOFILE=131072 # processes launched. LimitNPROC=512 -Restart=on-abnormal +# Restart server on any problem. +Restart=on-failure +# ... Unless it is a configuration problem. +RestartPreventExitStatus=2 ExecStart=/usr/bin/maddy -config /etc/maddy/%i.conf