Re: cron job schedule problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



2010/1/7 mcclnx mcc <mcclnx@xxxxxxxxxxxx>:
> We have CENTOS 5.3 on DELL server.  there has a cron job supposedly should run on 1st and 3rd week on Saturday but it run everyday.  anyone know what wrong?
>
>
> 01 08 1-7,15-21 * 6 program.sh
>

>From "man 5 crontab"
       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".


 01 08 1-7,15-21 * 6 program.sh

So you have the first field (minute), which says run if matched on minute 1.
The next field (hour), says run on the 8th hour.
The next field (day of month), says run on 1st through the 7th, and
15th through 21st.
The next field (month), says run every month.
The next field (day of week) says run on the 6th day (Saturday).

And then this is the important piece:
       Note: The day of a command’s execution can be specified by two fields —
       day of month, and day of week.  If  both  fields  are  restricted  (ie,
       aren’t  *),  the command will be run when either field matches the cur-
       rent time.  For example,
       "30 4 1,15 * 5" would cause a command to be run at 4:30 am on  the  1st
       and 15th of each month, plus every Friday.

So your above example will run every day from 1-7, any Saturdays in
between, and 15 through 21.
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux