Removing a specific USB device (like a flash drive or security key) triggers an immediate shutdown. It combines the following:
- A launch daemon that monitors USB devices
- A script that checks if your specific USB is still connected
- A shutdown command if it disappears
- Edit the DEVICE_NAME at the top of the script to match your USB stick (use system_profiler SPUSBDataType).