Created
January 29, 2020 23:53
-
-
Save tcrowe/b426b8ddf0fcd109953d467f202d8f13 to your computer and use it in GitHub Desktop.
Obliterate systemd service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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