1
0
Fork 0

obliterate-systemd-service

This commit is contained in:
Adrien Abraham 2022-09-13 10:56:12 +02:00
parent 14c08f8b6c
commit bebc1e982a

16
obliterate-systemd-service.sh Executable file
View file

@ -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