miércoles, 15 de septiembre de 2010

How to wake up to music with Linux

I remember that, to finish my thesis, I had to get up at 3AM for over two weeks. I had to sleep in my office and I used my computer to set and fire several alarms: one to play a song at the desired time, another one to launch the browser, and a third one to open the thesis document. Back then, I thought Windows was a great OS because I was able to do all that. However, to be honest, it was not Windows that was doing the trick, but third-party software.

Now that I migrated to Linux, I realized that you can achieve exactly the same but directly from the OS, that is, without resorting to third-party software at all.

This is the way to do it:

1. Before the OS loads, press the key that the computer tells you to get into the BIOS. It can be DEL, ESC, or any other key that the system indicates. You have to press it quickly; you will be taken to a screen that looks like this:

2. Once in the BIOS, look for the Power Management page and follow the screen instructions to get "Resume by Alarm" or "Power On Alarm". Set the desired time. Save (normally by pressing F-10), accept (yes) and then the computer reboots.

With this, the computer will turn on by itself at the desired time as long as it is plugged to a power outlet. That should be enough if you want the computer to wake you up. However, the idea is to make it play a song that you like and launch the programs that you need. To do that, you need to set some alarms in KOrganizer.

3. KOrganizer is hidden in Mandriva 2010 Spring. To find it, go to the bottom-right panel and click on the arrow to display it. KOrganizer, which is the program that will fire the alarms you set up, is a nice organizer that works pretty much like Outlook, only that KOrganizer is not so heavy on computer resources.

4. Once you find it, click to launch it and input the date and the time. You can just select the time periods as blocks on the schedule. Once you have set the time, you need to choose whether you wan to add an event or a "to-do" task. Actually, there is little difference for our purposes, but I normally go for "Add new event".

5. The following step is very easy: the alarms. There is a red icon that indicates the reminders.

You must click the box to be able to configure reminders. Once the box is checked, some options are enabled. Click on "advanced" to configure the time. Take into account that if the event is set at 8:30AM and you choose the reminder "5 minutes before the event starts", your alarm will go off at 8:26AM.

Now, if you want the computer to play a song for you, select "sound" and look for your song.Obviously, you have to click OK to confirm and your sound alarm will be ready. If you want to launch your browser, select "application" instead of "sound" and specify the name of your browser. You can do the same for any other program.

I hope this tutorial saves Linux newbies like me some time when there is not any to lose ;-)

7 comentarios:

Or, assuming your machine is up anyway (my workstation fetches in email every five minutes -- that keeps things awake)... You can do it all on the commandline.

Looking around, I see that 'wavplay' might not be in the repos, but there are commandline WAV players that are, so, if you're not up for the configure-make-make_install shuffle, substitute your own where I mention 'wavplay' here.

To get more than one thing happening as your wakeup event, script them (I use an X-10 module to turn on the lights here). Here's a sample wakeup.sh:#!/bin/bash/usr/local/bin/x10 a5 on &# let that light soak into tired eyes for 2 mins# before the noise begins...sleep 120/usr/local/bin/wavplay -q /usr/share/sounds/loudnoise.wav /usr/local/bin/mpg123 -q /home/user/Music/thrashmetal_wakerupper.mp3export DISPLAY=:0 && /usr/bin/firefox

To run it one time, use 'at':$ at 03:00warning: commands will be executed using /bin/shat>/usr/local/bin/wakeup.sh^Djob 4 at Mon Sep 20 03:00:00 2010

To run it every weekday morning, use 'cron'. Run 'crontab -e' to add this line to your crontab:00 03 * * 1-5 /usr/local/bin/wakeup.sh

3. Top 1 Rescue Distro:SimplyMepis! When something goes truly wrong, you can always count on this Linux distribution to rescue the system, get into the Web, modify files and make back ups. All that without mentioning it is almost easier to use than Windows ;-)