From 19d2901d4685ef2af3c5bc255beae1e5a028aa1b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 6 May 2021 13:05:21 +0200 Subject: [PATCH] Manage case of service already stopped --- data/helpers.d/systemd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data/helpers.d/systemd b/data/helpers.d/systemd index f9fe3ead0..9a9a2d9f8 100644 --- a/data/helpers.d/systemd +++ b/data/helpers.d/systemd @@ -88,6 +88,12 @@ ynh_systemd_action() { log_path="${log_path:-/var/log/$service_name/$service_name.log}" timeout=${timeout:-300} + # Manage case of service already stopped + if [ "$action" == "stop" ] && ! systemctl is-active --quiet $service_name + then + return 0 + fi + # Start to read the log if [[ -n "$line_match" ]] then