linux alarm clock

April 14th, 2007 mysurface Posted in bc, Misc, xmms | Hits: 47333 | 9 Comments »

I have too used to alarm clock, to wake me up every early morning. I set my alarm on my cellphone every night before I going to sleep. But recently, a simple stupid idea of creating an alarm clock in Linux comes to my mind.

I usually turns on my laptop overnight for some downloads, system updates. It is a basic requirement for a linux alarm clock. This example is a bit creepy, i know. But somehow it works.

First you need to calculate what time you wanna wake up? Let say if you wanna wake up after 5 hour and 30 minutes. You need to calculate the time in seconds using bc and parse the result to sleep, and later play a song to wakes you up after the sleep:

sleep `echo "60*60*5+60*30" | bc`; xmms -p

You can preloaded with any song and set your preferred volume.

The better and easy way should be using at or crontab. I have tried but it doesn’t seems to be working.

Such as ….

at 2:10  <<< "xmms -p"

or crontab

crontab -e

and write a line in

45 7 * * * /usr/bin/xmms -p

I have no idea why it fails :(

9 Responses to “linux alarm clock”

  1. FYI, Xmms have an alarm-plugin .. try it out :D
    http://freshmeat.net/projects/xmmsalarm/

    btw .. the crontab hack worked for me .. (you’ll need xmms running first of course)

  2. cool, the xmms-alarm is at my apt repo. Nice with complete function. Did I need to make XMMS running too?

    I try at terminal, execute xmms -p will open the xmms + play, donno why it doesn’t happen to at and crontab.

  3. surface, the crontab hack is working for me too

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

  5. You don’t need xmms runing, only an X server.
    xmms needs an X server to work.

  6. i need to learn handle server by linux

  7. at 1:09 <<< “DISPLAY=:0 amarok -p”

  8. This worked for me:
    > echo “DISPLAY=:0 xmms -p” | at 09:33

  9. Been trying the crontab alarm clock idea for a while for a while; it might be it doesn’t work because it runs it in the background? Dunno…

Leave a Reply