Mplayer Alarm Clock
April 15th, 2007 aizatto Posted in mplayer | Hits: 10805 |
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
Live Chat!









Leave a Reply