Home   >>   Cron   >>   Cron Sample Usage
Cron Sample Usage PDF Print E-mail
( 0 Votes )
How To - Cron
Written by Christian Foronda   
Sunday, 05 September 2010 09:36

Six fields:

	1 minute (0-59)
2 hour (0-23)
3 day of month (1-31)
4 month (1-12, or name such as jan, feb, etc)
5 day of week ( 0-6(6 = Sunday) or name such as mon, tue,etc)
6 command to run

Or

	1 2  3   4   5     6
m h dom mon dow command

Edit cron entries:

	# crontab -e

Run the command 2:00PM on Friday, September 3

	0 14 3 9 4 command
or
0 14 3 sep fri command

Run the command every hour:

	0 * * * * command

Run the command every two hours:

	* */2 * * * command

Run the command every minute:

	*/1 * * * * command

Run the command every half hour:

	*/30 * * * * command

Run the command every half and quarter of an hour:

	30,45 * * * * command

Run the command every Monday to Friday only:

	* * * * 0-4 command

Run the command every 1st to 7th day of the month:

	* * 1-7 * * command

Run the command on 1st to 7th day of the January:

	* * 1-7 01 * command

Run the command on 1st and 7th day of the month:

	* * 1,7 * * command

Run the command run every 2 hours, at half past and a quarter of, and run for the first 7 days of a month:

	30,45 */2 1-7 * * command

To avoid receiving email of the output:

	30,45 */2 1-7 * * command >> /dev/null 2>&1



blog comments powered by Disqus
Last Updated on Tuesday, 07 September 2010 15:56