Cron is a Unix/Linux etc .. utility thaat allows the tasks to be run at specific time as well as at specific intervals..The job that the program does are know as CronJobs and are stored in a table (Cron Table)..
To schedule any task with cron we can use crontab command in Unix..
Lets just edit the file and see what it contains:-
As we have no basic cronjobs setup the program will create a new file for us..
Now lets edit the file :-
file : /tmp/crontab.uCLp62/crontab
The skeleton comment on the first line of the program represents the syntax of the time stamp..
Explanation :-
Note : '*' opereator serves as a wildcard and represents all possible values in a field..Other than that..More that one value for a field should be seperated with comma's..
Thats quite a bit of explanations now lets just set up a cronjob.
As I am working late night at 1:00 AM too..
This test script will speak hello world when the clock strinkes .. 1:01 AM
Note:The hours are inputed in 24hr format!!
Now what if we want the script to say hello world each minute :-
or
This script runs every minute of every hour..
So this script runs every minute...
Using
To schedule any task with cron we can use crontab command in Unix..
Lets just edit the file and see what it contains:-
Code:
aneesh@aneesh-laptop:~$ crontab -e no crontab for aneesh - using an empty one crontab: installing new crontab
Now lets edit the file :-
Code:
crontab -e
Code:
# m h dom mon dow command
Explanation :-
Code:
m : minutes {0-59}
h : hours {0-23}
dom : day of month {1-31}
mon : month {1-12}
dow : day of week { 0-6 } 0=Sunday , 6=Saturday
command : The command to be executed
when the timestamp is reached
Thats quite a bit of explanations now lets just set up a cronjob.
Code:
1 1 * * * espeak "Hello World"
This test script will speak hello world when the clock strinkes .. 1:01 AM
Note:The hours are inputed in 24hr format!!
Now what if we want the script to say hello world each minute :-
Code:
# m h dom mon dow command 1-59 1-23 * * * espeak "Hello World"
Code:
# m h dom mon dow command * * * * * espeak "Hello World"
So this script runs every minute...

