Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[helpers v2.1]: ynh_remove_systemd_config: Also remove the systemd service f… #1882

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions helpers/helpers.v2.1.d/systemd
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,20 @@ ynh_config_add_systemd() {
systemctl daemon-reload
}

# Remove the dedicated systemd config
# Remove the dedicated systemd config, and if configured into YunoHost, removes the service.
#
# usage: ynh_config_remove_systemd service
# | arg: service - Service name (optionnal, $app by default)
ynh_config_remove_systemd() {
local service="${1:-$app}"

if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
yunohost service remove "$app"
fi

if [ -e "/etc/systemd/system/$service.service" ]; then
ynh_systemctl --service=$service --action=stop
systemctl disable $service --quiet
ynh_systemctl --service="$service" --action=stop
systemctl disable "$service" --quiet
ynh_safe_rm "/etc/systemd/system/$service.service"
systemctl daemon-reload
fi
Expand Down
Loading