Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Obliterate systemd service
#!/bin/zsh
#
# Obliterate systemd service
# https://superuser.com/questions/513159/how-to-remove-systemd-services#936976
#
systemctl stop $1 2>/dev/null || true
systemctl stop $1.service 2>/dev/null || true
systemctl disable $1 2>/dev/null || true
systemctl disable $1.service 2>/dev/null || true
systemctl daemon-reload 2>/dev/null || true
systemctl reset-failed 2>/dev/null || true
rm -f /etc/systemd/system/$1
rm -f /etc/systemd/system/$1.service
rm -f /usr/lib/systemd/system/$1
rm -f /usr/lib/systemd/system/$1.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.