Update src/killsw

This commit is contained in:
2026-03-24 19:52:18 +01:00
parent 31a999c019
commit f9bb3c21a9

View File

@@ -3,22 +3,35 @@
VERSION="1.0.1" VERSION="1.0.1"
cmd="$1" cmd="$1"
group="$2"
case "$cmd" in case "$cmd" in
stop) stop)
systemctl stop killswitch.target if [[ -n "$group" ]]; then
echo "Killswitch activated: all linked services have been stopped." # Alleen die groep stoppen
systemctl stop "$group".target
echo "Killswitch activated: stopped group '$group'."
else
# Geen groep, alles stoppen
systemctl stop killswitch.target
echo "Killswitch activated: all linked services have been stopped."
fi
;; ;;
start) start)
systemctl start killswitch.target if [[ -n "$group" ]]; then
echo "Killswitch deactivated: all linked services have been started." systemctl start "$group".target
echo "Killswitch deactivated: started group '$group'."
else
systemctl start killswitch.target
echo "Killswitch deactivated: all linked services have been started."
fi
;; ;;
status) status)
systemctl status killswitch.target systemctl status killswitch.target
;; ;;
add) add)
if [[ -n "$2" && "$3" == "to" && -n "$4" ]]; then if [[ -n "$2" && "$3" == "to" && -n "$4" ]]; then
echo "Called add $2 to $4" echo "Adding service '$2' to group '$4'..."
else else
echo "Usage: killsw add [service] to [group]" echo "Usage: killsw add [service] to [group]"
fi fi