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:
- Open /etc/crontab with your favourite text editor (no need for crontab -e since this is the system wide crontab), e.g.
1sudo gedit /etc/crontab
- Add the following lines (replace manker with your username!)
1225 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-4 means that the commands are executed at 23:25, but only Sunday (day 0) to Thursday (day 4). Read man 5 crontab for a detailed description of that format.
- The first command uses zenity to 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 manker to your username (root does not work either).
- The second command shutdown -h +5 means 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.