Cron Alarm Clock

Surprisingly I found out that there are a lack of alarm clocks in Linux. I’ve tried a few but really was impressed with none. So I decided to go with what the Linux uses for some of it’s timed events: Cron. Cron can be a good alarm and its easy to use.

The program crontab is used to create and edit cron jobs and the cron daemon checks for cronjobs a the top of every minute. A command line mp3 player can be used here but I like use Audacious. Crong will need to be told what X display to play Audacious on to discover the current display:

env | grep DISPLAY

Then as regular user edit crontab:

crontab -e

Here’s the cronjob layout representation:

#   minute (0-59),
#   |   hour (0-23),
#   |   |   day of the month (1-31),
#   |   |   |   month of the year (1-12),
#   |   |   |   |   day of the week (0-6 with 0=Sunday).
#   |   |   |   |   |   commands

Enter the time (multiple times, days need to be separated with commas) and the script to execute for the alarm. The asterik can be used (*) to satisfy all variables. Here’s mine for audacious:

07  21  *   *   1,2,3,4,5   env DISPLAY=:0.0 audacious /home/user/My\ Music/Other/Alarms/301gq.mp3

I found some good alarm tracks at this site the were perfect for the task.

To list the crontab do:

crontab -l 

Additional Information

Other Options


Wmtimer works well for Gnome users (KDE has kalarm) it leaves a small window on the screen which can’t be hidden but it is able use the system beep or execute a command on an alarm/timer event. Starting it from the command line is pretty easy:

wmtimer -a -t 18:39:00 -e "mpg321 ~/Music/Other/Alarms/301gq.wav"


Audacious also has alarm ability but it’s buried DeeeEEep in it’s preferences ( Preferences > Plugins > General ).

Alarm Clock

Thats actually its name. Despite the unexciting name, Alarm Clock is a very nice addition. Its a python script for the Gnome desktop that has the ability to run an application, display a message, and to use as a tray icon. Its a good application and easy to install.


Zenity Alert

Zenity is Gnome’s notification program. This won’t get a person out of bed but it can be good for reminders. In crontab enter:

Note: I wasn’t able to get this to work. If anyone can figure it out please let me know.

    23  15  *   *   * env DISPLAY=:0:0 notify-send -i gtk-info "libnotify          example" "An example of libnotify notification thingy."
  • Thanks 2 keyboard cowboy.

About Gen2ly

<3's linux

Posted on 2008-01-19, in Command Line. Bookmark the permalink. 8 Comments.

  1. Я круче нигде не видел.

  2. thanks dude, came in handy for work :)

  3. Thanks for doing the research for us. This was helpful today, and as with the previous comment, this was for work for me too.

  4. I’m sorry, but the Cron alarm clock system seemed way over my head. However, when I pressed “this site” on your Cron display, I found my self amused with all of the
    alarm sounds. I was truly enjoying myself.

  5. It’s notify-send “text”

  6. Haha, you use a general quarters alarm? Didn’t know anyone else did. It’s *the* sound that gets me going. :P

  7. I was using cron with clementine and it worked fine. When i switched to audacious (clementine became a feature-bloat as expected) my alarm would never ring! The env DISPLAY=:0.0 did it for me, thanks!
    ps. I use audacious -p so the already open audacious can just start playing. Cheers

  1. Pingback: Cron Alarm Clock « Linux T&T

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 58 other followers

%d bloggers like this: