#!/bin/bash VERSION="1.0.0" cmd="$1" case "$cmd" in stop) systemctl stop killswitch.target echo "Killswitch activated: all linked services have been stopped." ;; start) systemctl start killswitch.target echo "Killswitch deactivated: all linked services have been started." ;; status) systemctl status killswitch.target ;; help|-h|--help) cat << EOF KillSwitch CLI Tool - v$VERSION USAGE: killsw COMMANDS: stop Stop all services linked to killswitch.target start Start all services linked to killswitch.target status Show the current status of the killswitch target -h, --help Show this help message -v, --version Show version information ABOUT KILLSWITCH: What it does: Stops all services that are linked to 'killswitch.target'. This allows you to perform an emergency stop or centralized management of multiple services. Why it's needed: Useful for quickly stopping servers or services in case of maintenance, emergency, or to prevent unsafe operations. How to enable it on your services: 1) Create or edit your systemd service to link it to killswitch.target: Add the following to your [Unit] section: PartOf=killswitch.target 2) Optionally, enable the service to start at boot: sudo systemctl enable .service 3) Start/stop via this script: killsw start killsw stop EOF ;; -v|--version) echo "KillSwitch CLI Tool version $VERSION" ;; *) echo "Unknown command: $cmd. Use --help to see available commands." ;; esac