Skip to content

Instantly share code, notes, and snippets.

@lucascantor
Created January 27, 2018 07:48
Show Gist options
  • Save lucascantor/9915c4a9c6deb60fb0a5183e770b5647 to your computer and use it in GitHub Desktop.
Save lucascantor/9915c4a9c6deb60fb0a5183e770b5647 to your computer and use it in GitHub Desktop.
Shut down (and require password to unlock FileVault) if .dead_mans_switch hasn't been touched within the past 24 hours
#!/bin/bash
if [ $(find /Users/<username>/ -mtime -1 -type f -name ".dead_mans_switch" 2>/dev/null) ]
then
echo "Dead mans switch has been touched today."
else
echo "Dead mans switch has NOT been touched today. Shutting down now."
/sbin/shutdown -h now
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment