Cron and mp3blaster -> Alarm Clock II
I have already written about a method of creating the alarm clock using mp3blaster and cron. That method (described here) however does not work well with some programs running or if you do not have X session. This may prove problematic. So, I am here with a new way of doing the same thing that uses a software called screen1. Using screen can make this task very easy.
I have a file named alarm.mp3 in my home at /home/aditya/alarm.mp3. Once I install screen, I can edit crontab using ‘crontab -e’ command and then insert a line,
30 07 * * 1-6 screen -d -m -S mp3blaster mp3blaster /home/aditya/alarm.mp3
That’s all. Once you do that, the file ‘alarm.mp3′ will be played every weekday and Saturday morning at 0730 hours. What it does it, the option -d and -m, when used together, create a screen session (if you do not know what screen is, please ignore this as your work is done now. Wait for my post about screen to follow) and it is detached. So, the commands used previously for display and other environment options are not necessary. This reduces the possibility of failure.
Next up is the -S command that gives a name to the session. The first mp3blaster is the name of the session, second is the command to execute. So that’s it. Go and change your code if you had one. This one is much better I can guaranty you.
Links
Posts in the series, Going the CLI Way :-
- More about screen to follow in the Completely going the CLI way series [↩]
This entry was posted on Thursday, May 29th, 2008 at 2:55 am and is filed under Console, HowTo, Linux, System Configuration, Tools. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.


Aditya May 30th, 2008 at 1:44 am
Nice to know it helps. Problem with me is, my mom woke up with the sound of alarm.mp3 (better not to mention which song
) and she has strictly told me to put it off cause the song ended… 4 minutes of bombing and there was I sound asleep. Moreover, terminal was locked, so she could not switch it off. :p … Nothing can wake me up 