From bebc1e982af34e58c03c5d3a4c2b115136d1236b Mon Sep 17 00:00:00 2001 From: Adrien Abraham Date: Tue, 13 Sep 2022 10:56:12 +0200 Subject: [PATCH] obliterate-systemd-service --- obliterate-systemd-service.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 obliterate-systemd-service.sh diff --git a/obliterate-systemd-service.sh b/obliterate-systemd-service.sh new file mode 100755 index 0000000..995ea6a --- /dev/null +++ b/obliterate-systemd-service.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Purge a systemd service that won't gtfo. + +usage() { + echo "Usage: $0 [service name, without .service]" +} + +[ $# -ne 1 ] && usage && exit +name="$1" + +sudo systemctl stop "$name" +sudo systemctl disable "$name" +fdfind "$name" /etc/systemd/system -t f -t l -x sudo rm -i +fdfind "$name" /usr/lib/systemd/system -t f -t l -x sudo rm -i +sudo systemctl daemon-reload +sudo systemctl reset-failed