Cron Alarm Clock

What is Cron?

Cron enables users to schedule jobs (commands or shell scripts) to run automatically at a certain time or date. It is commonly used to perform system maintenance or administration, though its general purpose nature means that it can be used for other purposes, such as connecting to the Internet and downloading email.

Cron uses the crontab, a configuration file that specifies shell commands to run periodically on a given schedule.

Crontab has following options:

-l    list the crontab

-e    edit the crontab

-r    remove the crontab

The application “crontab” is used to create and edit cron jobs and the cron daemon checks for cronjobs a the top of every minute.

For example :

crontab -e

It opens the vi editor to enter the cron jobs.

It looks like

#   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

For Example:
55 10 8 11 * echo “This runs at 10:55 on 8th November”

To list all cron jobs:

crontab -l

To remove a cron job :

crontab -r

For alarm clock, A Command Line Mp3 player can be used here that is mpg321. you may use any mp3 player here but you have to specify what X display to play your player.

For Command Line Mp3 Player,

30  04  *   *   * mpg321 "/home/sriram/Music/Alarm1.mp3"

 

For Other Mp3 Player(Audacious):

30  04  *   *   * env DISPLAY=:0.0 audacious "/home/sriram/Music/Alarm1.mp3"

 

The asterik can be used (*) to satisfy all variables. I found some good alarm tracks at this site the were perfect for the task

 

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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