Skip to content

Instantly share code, notes, and snippets.

@tcrowe
Created January 29, 2020 23:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcrowe/b426b8ddf0fcd109953d467f202d8f13 to your computer and use it in GitHub Desktop.
Save tcrowe/b426b8ddf0fcd109953d467f202d8f13 to your computer and use it in GitHub Desktop.
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