Prompt yourself every 5 minutes after 7 PM if you really want to still be using your computer or not. This helps to avoid late night device use. You can dismiss the dialog every 5 minutes. If you don't dismiss it within 15 seconds your computer will shutdown.
- Add the
shutdown.applescript
to your local bin folder~/.local/bin/shutdown.applescript
. You may have to create this directory first withmkdir -p ~/.local/bin
. Make the script executable withchmod +x ~/.local/bin/shutdown.applescript
. - Allow your user to use sudo to invoke
shutdown
without prompting for a password by adding a sudoers file:
echo "$USER ALL=NOPASSWD: /sbin/shutdown" | sudo tee /etc/sudoers.d/shutdown > /dev/null
- Install the crontab via
crontab -e
.