Mobile Phone, Broken Screen

I was in a country far far away last month. So far that there was no broadband access (yes, this is possible). Anyway… Generally I use my mobile phone as a clock and as an alarm clock. Unfortunately I brake it down just before my night flight.

So, to simplify, I was abroad in a hotel, the sun was down since a while, I was tired, and I had to wake up early. No electronic devices to help me, except my laptop… And then came the idea to combine cron and mplayer to automaticcaly play some MP3s at a given time.

Here is how I’ve done it. First, as root , create an empty file in /etc/cron.d/ . Let us call it wake-up :

1$ touch /etc/cron.d/wake-up

Then edit it to put the following command:

15 6 * * * root mplayer /home/kevin/music/CoolCavemen/AllCoolHits/*.flac > /dev/null 2>&1 /dev/null

This mean that mplayer will be launched at 6:15 and will play all FLAC files from the /home/kevin/music/CoolCavemen/AllCoolHits/ directory. I let you adapt those parameters to fit your needs.

Random Tips:

  • Take care of time zone (system time and local time are very different).

  • Check that your volume is not muted and crank the volume up!

  • Run the mplayer /home/kevin/music/CoolCavemen/AllCoolHits/*.flac > /dev/null 2>&1 /dev/null command alone in another terminal before you go to sleep to be sure it work (i.e. to check that all sound-related sub-systems are loaded).

  • Be sure that cron daemon is up an running (do a /etc/init.d/crond restart if you are not sure).

2 archived comments

Comments are closed. These were posted on Disqus, and are archived here.

  1. Wake Up Early

    Geeks can always find a solution :)

  2. So I'm not the only one to do this !

    I've switched from cron to at however, as I don't woke up at the same time each day.

    So I do something like this :

    echo "mplayer /media/Data/Musique/*/*" | at 8h20