Mplayer Alarm Clock

April 15th, 2007 aizatto Posted in mplayer | Hits: 35184 | 3 Comments »

Note: This was done under Ubuntu Edgy Eft (6.10)

So I saw surface’s post on a Linux Alarm Clock using xmms.

In spirit of choice, I will show you my Mplayer Alarm Clock!

First I need to create a playlist. You can add the file you want to play (with fullpath) to a file. I do this by first going to the directory I want to make a playlist from, and execute the following command:

find "`pwd`" -name "*.mp3" -print >> playlist;

Next I make a script which plays that playlist and save it into say /home/aizat/scripts/alarm.sh

#!/usr/bin/bash
mplayer -really-quiet -loop 0 -shuffle -playlist PATH_TO_PLAYLIST/playlist

Don’t forget to chmod it:

chmod u+x ~/scripts/alarm.sh

Execute the script and see if it works.

If it does, lets add a entry to the crontab (/etc/crontab):

45 6  * * * aizat /home/aizat/scripts/alarm.sh


Note: If your crontab does not support running the application under a different unse, omit the username.

This means at 6:45am every day of the week, execute the script under my user. I chose to use my user so that I can wake up and kill mplayer:

pkill mplayer

3 Responses to “Mplayer Alarm Clock”

  1. Mplayer Alarm Clock » Linux by Examples – just great!

  2. Mplayer Alarm Clock » Linux by Examples – just great!

  3. Hello my friend! I wish to say that this post is awesome, great written and come with approximately all important infos. I would like to see extra posts like this .

Leave a Reply