CRON TABLE is used to execute tasks in unix,solaris operating systems.
IT is used to execute scheduled tasks at specific times.

Two files : /usr/lib/cron/cron.allow and /usr/lib/cron/cron.deny
determine who can and cannot use the cron jobs.

If only cron.deny file exists and is empty, all users can use crontab.
If none of the two files exist, only the root can use crontab and the files
contain one username per line.

Cron Commands:

#crontab -e ===== For editing current crontab,or create new if doesnot exist
#crontab -l ===== Display crontab file
#crontab -r ===== Remove Crontab file
#crontab -v ===== Display the last time when crontab was edited.

CronTab File Format :

Crontab file has five fields for specifying the day,date and time etc. for the command
to run

*    *    *    *    *    Here goes command to be executed
–    –    –    –    –
|    |    |    |    |_______ Day Of Week (0-6) ( Sunday = 0)
|    |    |    |
|    |    |    |_______________ Month (1-12)
|    |    |
|    |    |_______________________ Day of Month (1-31)
|    |
|    |_______________________________ Hour (0-23)
|
|_______________________________________ Minutes (0-59)

Note :
> * in the value of field means all valid values for that column.
> The value can have a * or a list of nummber in the range or two numbers in the range separated by a hyphen which means an inclusive range.
> Repeat pattern like /5 for every 5 minutes or /10 for every 10 minutes(but might not be supported by all OS).
> The days can be specified in two fields: month day and weekday. If both are specified in an entry,both of them will be executed.

Examples :

Removes files from tmp every day at 7.45 PM

45    19    *    *    * rm /home/test/tmp/*

Minutes    Hour    Day/Month    Month    day/Week   Exectution Time

30    0    1        1,6,12     *       00:30 hrs. on 1st of Jan,June&Dec
0    20    *             10    1-5       8.00 PM Every weekday (Mon-Fri) in OCT
0    0    1,10,15        *    *       midnight on 1st,10th & 15th of month
5,10    0    10        *    1       12.05,12.10 every monday & on 10th of
every month

To collect the cron execution execution log in a file :

30 18 * * * rm /home/someuser/tmp/* > /home/someuser/cronlogs/clean_tmp_dir.log