Re: setup schedule cron job every other week?

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



From: Brent L. Bates <blbates@xxxxxxxxxx>
> From: mcclnx mcc
> >   0 0 8-31/14 * 6 /script.sh
> From: John Doe 
> >   0 0 8-14 * 6 /script.sh
> >   0 0 22-28 * 6 /script.sh
>      According to the man page, neither of these will not do what the OP
> wants.  Both will execute the command EVERY Saturday.  The first will also
> execute it on the 8th and 22nd of the month.  The second will execute the
> command TWICE a day AND days 8-14 AND 22-28.  The man pages says if any of the
> day parameters match, the command is executed.  Unfortunately for the OP, the
> day parameters are an OR operation and not an AND operation.

Oops, I missed that part... you are right.
Guess the date check will have to be out of cron...
In case the even/odd week of the year does not work (I am not sure all months will start on odd weeks; do they?), here's another try:
0 0 * * 6 [ $((`date +"%d"`%14)) -ge 8 ] && script.sh
Would that work?

JD


      
_______________________________________________
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