From 266408e23599a27ea196fbd4cdfd3ec1ea1f2871 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Thu, 23 May 2024 18:51:16 +0200 Subject: [PATCH] do not enable a service disabled by the user --- helpers/systemd | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/helpers/systemd b/helpers/systemd index 765c575ef..f657386bd 100644 --- a/helpers/systemd +++ b/helpers/systemd @@ -25,7 +25,10 @@ ynh_add_systemd_config() { ynh_add_config --template="$template" --destination="/etc/systemd/system/$service.service" - systemctl enable $service --quiet + # do not enable a service disabled by the user + if ! yunohost service status $service | grep -q "start_on_boot: disabled"; then + systemctl enable $service --quiet + fi systemctl daemon-reload } @@ -88,6 +91,11 @@ ynh_systemd_action() { return 0 fi + # do not start a service disabled by the user + if [ "$action" == "start" ] && ! yunohost service status $service_name | grep -q "start_on_boot: disabled"; then + return 0 + fi + # Start to read the log if [[ -n "$line_match" ]]; then local templog="$(mktemp)"