do not enable a service disabled by the user

This commit is contained in:
OniriCorpe 2024-05-23 18:51:16 +02:00
parent d5e054fe80
commit 266408e235

View file

@ -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)"