A script to monitor for usb drive and shutdown computer when removed.
git clone https://github.com/jamiehoward/usb-shutdown
cd usb-shutdown
chmod +x check.sh
- Plug in a USB drive
sudo check.sh /Volumes/drive/
- Put in your password
- Remove the USB drive, either forcefully or by ejecting it.