Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: CRon help

RE: CRon help

From: <oracle-l-bounce_at_freelists.org>
Date: Thu, 23 Jun 2005 08:55:34 -0700
Message-ID: <04DDF147ED3A0D42B48A48A18D574C4502361186@NT15.oneneck.corp>


Prem, I just re-read your email and I think we are in agreement, I just misunderstood the first time I read it because I think I skipped over the "something better, like this" line. Sorry for the confusion.

-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Allen, Brandon Sent: Thursday, June 23, 2005 8:47 AM
To: premjhere_at_gmail.com; oracle-l; thump_at_cosmiccooler.org; John.Hallas_at_gb.vodafone.co.uk
Subject: RE: CRon help

Prem,

I believe the following command will work as advertised:

0 1 8-14 * * [ "$(date +\%a)" == "Sat" ] && script_with_no_date_logic

Yes, the command "[ "$(date +\%a)" == "Sat" ] && script_with_no_date_logic" will run every day between the 8th and 14th of each month, but due to the && operator, the script_with_no_date_logic will only be executed if [ "$(date +\%a)" == "Sat" ] evaluates to TRUE, so in other words, the script portion of the command will only be executed on Saturdays that fall between the 8th and 14th.

Only way to find out for sure is to test it.

Regards,
Brandon

-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Prem Sent: Thursday, June 23, 2005 3:50 AM
To: oracle-l; thump_at_cosmiccooler.org; John.Hallas_at_gb.vodafone.co.uk Subject: RE: CRon help

Hi John , the same thread had this too : )



>From the crontab documentation (man page):

"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 current 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 the example below would run every Saturday plus 8th-14th of the month, not what you want.

A quick search of Google gives you something better, like this:

0 1 8-14 * * [ "$(date +\%a)" == "Sat" ] && script_with_no_date_logic


Regards,
Prem.

-----Original Message-----
>> From: oracle-l-bounce_at_freelists.org

[mailto:oracle-l-bounce_at_freelists.org] On >> Behalf Of Hallas, John, Tech Dev

>> Charlotte Hammond suggested this to a similar question recently

>> Something like this (1am on 2nd Saturday):

>> 00 01 8,9,10,11,12,13,14 * 6 /app/my_saturday_job.sh

>> Takes advantage of the fact that the second Saturday can only
possibly fall in >> the range of dates 8th to the 14th of the month (and no other Saturday can fall on >> those days!)

--
http://www.freelists.org/webpage/oracle-l

Privileged/Confidential Information may be contained in this message or attachments hereto. Please advise immediately if you or your employer do not consent to Internet email for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of this company shall be understood as neither given nor endorsed by it.

--
http://www.freelists.org/webpage/oracle-l
--
http://www.freelists.org/webpage/oracle-l
Received on Thu Jun 23 2005 - 11:59:39 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US