What?
I am a long-term StumbleUpon user, which means that I don’t get much sleep. Now, after almost 4 years of stumbling, I have decided to get my life back. Well, at least some sleep!
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.
I use this little trick with Ubuntu, but it should work anywhere where Gnome is installed.
How?
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 forcrontab -e
since this is the system wide crontab), e.g.sudo gedit /etc/crontab
- Add the following lines (replace
manker
with 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-4
means that the commands are executed at 23:25, but only Sunday (day 0) to Thursday (day 4). Readman 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 changemanker
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.
Sweet dreams!