Thursday, March 29, 2012

Crontab Line Syntax

Every time that I am setting up a new job in crontab, I have to go look up the syntax for the parameters for the lines.  I can never remember the order of the parameters.  So, here they are:

*     *    *    *    *
|     |    |    |    |
|     |    |    |    ---------- day of week (0 - 6) Sunday is day 0
|     |    |    ------------- month (1 - 12)
|     |    ---------------- day of month (1 - 31)
|     ------------------- hour (0 - 23)
----------------------- minute (0 - 59)


An example line would be the following:

30 5 * * 1-5 /etc/run.me

This app would run at 5:30 AM every Mon - Fri

Another example would be the following:

0,15,30,45 * * * * /etc/run2.me


This app would run every 15 minutes all of the time.


No comments:

Post a Comment