From 8e9e091656f2a72a37e21c173ed0c2015e97e726 Mon Sep 17 00:00:00 2001 From: mmetc <92726601+mmetc@users.noreply.github.com> Date: Mon, 26 Feb 2024 13:44:40 +0100 Subject: [PATCH] systemd: check configuration before attempting reload (#2861) --- config/crowdsec.service | 1 + debian/crowdsec.service | 1 + rpm/SOURCES/crowdsec.unit.patch | 2 ++ 3 files changed, 4 insertions(+) diff --git a/config/crowdsec.service b/config/crowdsec.service index 147cae494..65a8d30bc 100644 --- a/config/crowdsec.service +++ b/config/crowdsec.service @@ -8,6 +8,7 @@ Environment=LC_ALL=C LANG=C ExecStartPre=/usr/local/bin/crowdsec -c /etc/crowdsec/config.yaml -t -error ExecStart=/usr/local/bin/crowdsec -c /etc/crowdsec/config.yaml #ExecStartPost=/bin/sleep 0.1 +ExecReload=/usr/local/bin/crowdsec -c /etc/crowdsec/config.yaml -t -error ExecReload=/bin/kill -HUP $MAINPID Restart=always RestartSec=60 diff --git a/debian/crowdsec.service b/debian/crowdsec.service index b65558f70..c1a5e4037 100644 --- a/debian/crowdsec.service +++ b/debian/crowdsec.service @@ -8,6 +8,7 @@ Environment=LC_ALL=C LANG=C ExecStartPre=/usr/bin/crowdsec -c /etc/crowdsec/config.yaml -t -error ExecStart=/usr/bin/crowdsec -c /etc/crowdsec/config.yaml #ExecStartPost=/bin/sleep 0.1 +ExecReload=/usr/bin/crowdsec -c /etc/crowdsec/config.yaml -t -error ExecReload=/bin/kill -HUP $MAINPID Restart=always RestartSec=60 diff --git a/rpm/SOURCES/crowdsec.unit.patch b/rpm/SOURCES/crowdsec.unit.patch index af9fe5c31..5173beb27 100644 --- a/rpm/SOURCES/crowdsec.unit.patch +++ b/rpm/SOURCES/crowdsec.unit.patch @@ -9,5 +9,7 @@ +ExecStartPre=/usr/bin/crowdsec -c /etc/crowdsec/config.yaml -t -error +ExecStart=/usr/bin/crowdsec -c /etc/crowdsec/config.yaml #ExecStartPost=/bin/sleep 0.1 +-ExecReload=/usr/local/bin/crowdsec -c /etc/crowdsec/config.yaml -t -error ++ExecReload=/usr/bin/crowdsec -c /etc/crowdsec/config.yaml -t -error ExecReload=/bin/kill -HUP $MAINPID Restart=always