What does this do?
Every night when I have to work on the next day (Sunday night to Thursday night), at 23:25 my computer shows me this little warning message:
After the 5 minutes have passed, the computer shuts itself automatically down.
Thanks to the power of Linux, this is not difficult to do for yourself, and configure it however you want it to behave:
/etc/crontabwith your favourite text editor (no need for
crontab -esince this is the system wide crontab), e.g.
sudo gedit /etc/crontab
- Add the following lines (replace
mankerwith your username!)
25 23 * * 0-4 manker /usr/bin/zenity --display :0 --warning --text="Shutdown in 5 minutes. Go to bed." 25 23 * * 0-4 root shutdown -h +5
The first part of both lines
25 23 * * 0-4means that the commands are executed at 23:25, but only Sunday (day 0) to Thursday (day 4). Read
man 5 crontabfor a detailed description of that format.
The first command uses
zenityto show a warning message. You have to execute this as the same user that you use for working, or you will not see the message, so change
mankerto your username (root does not work either).
The second command
shutdown -h +5means that the computer will halt in 5 minutes. This has to be run as root, and it also shows nice warning messages in all your open terminals so you can’t really miss it.
- Save the file, and stumble until it is 23:25.