Tuesday, July 22, 2008

About Crontab

Crontab(Cron Table) :

Crontab is is a file which contains the schedule of cron entries to be run and at specified times.

crontab -l : Display crontab file

crontab -e : Edit existing cron file or create if it doesn't already exist.

crontab -r : Remove crontab file


Syntax:


* * * * * command to be executed


First * -------->minutes(0-59)

Second * -------->Hour(0-23)

Third * -------->Day of Month(1-31)

Fourth * -------->Month (1-12)

Fifth * --------->Weeks (0-6) 0=sunday


Ex:

10 20 * * * ls -lrt /home/test ------------------> This command will be executed at 8.10 pm daily


Generate Log file:

10 20 * * * ls -lrt /home/test 2>&1 >> /home/test/list.log

No comments: