1
0
Fork 0
Scripts/obliterate-systemd-service.sh

17 lines
402 B
Bash
Raw Normal View History

2022-09-13 10:56:12 +02:00
#!/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