#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    488
    Rep Power
    12

    Schedule job to run on 20th and 28th every month


    Hi all.

    I want to schedule a job to run on the 20 and 28th of every month at 6:00 AM. What is the proper syntax for this?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,436
    Rep Power
    1688
    A quick man crontab shows us that:
    The time and date fields are:

    field allowed values
    ----- --------------
    minute 0-59
    hour 0-23
    day of month 1-31
    month 1-12 (or names, see below)
    day of week 0-7 (0 or 7 is Sun, or use names)

    A field may be an asterisk (*), which always stands for "first-last".

    Ranges of numbers are allowed. Ranges are two numbers separated with a
    hyphen. The specified range is inclusive. For example, 8-11 for an
    "hours" entry specifies execution at hours 8, 9, 10 and 11.

    Lists are allowed. A list is a set of numbers (or ranges) separated by
    commas. Examples: "1,2,5,9", "0-4,8-12".

    So:
    Code:
    00 06 20,28 * * /path/to/command
    Should do what you want.

    Comments on this post

    • nikko50 agrees
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc

IMN logo majestic logo threadwatch logo seochat tools logo