diff --git a/helpers/systemd b/helpers/systemd index 765c575ef..4a3a46a7e 100644 --- a/helpers/systemd +++ b/helpers/systemd @@ -29,7 +29,7 @@ ynh_add_systemd_config() { systemctl daemon-reload } -# Remove the dedicated systemd config +# Remove the dedicated systemd config, and if configured into YunoHost, removes the service. # # usage: ynh_remove_systemd_config [--service=service] # | arg: -s, --service= - Service name (optionnal, $app by default) @@ -44,6 +44,10 @@ ynh_remove_systemd_config() { ynh_handle_getopts_args "$@" local service="${service:-$app}" + if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then + yunohost service remove "$app" + fi + local finalsystemdconf="/etc/systemd/system/$service.service" if [ -e "$finalsystemdconf" ]; then ynh_systemd_action --service_name=$service --action=stop