Re: Unix - scheduling - I know this, it's a UNIX system

2002-07-03 Thread Brian_P_MacLean


I knew about the start date/offset thingy, but hey, ya gotta leave him
something to figure out

As for the end of year, yeah, you're right.  Every year is a problem.
Since this is an Oracle news list we could just call Oracle from our shell
script and ask for the daze since some constant date and today, do the mod
28 math, and if it's zero, confinue to run the script, otherwise end.

I was just trying to show an inventive way to use cron.

Have a good 4th all.



   
 
  [EMAIL PROTECTED]
 
  om   To:   Multiple recipients of list 
ORACLE-L <[EMAIL PROTECTED]>
  Sent by: cc: 
 
  [EMAIL PROTECTED]     Subject:  Re: Unix - scheduling - I 
know this, it's a UNIX system
   
 
   
 
  07/03/02 03:39 PM
 
  Please respond to
 
  ORACLE-L 
 
   
 
   
 






-- [EMAIL PROTECTED] on 07/03/02 14:13:30 -0800

>
> This will run the job every 28 daze at 1am.  If that's not exactly the
> definition of every 4th week let me know and I'll work something out.
Also
> note that you will have an anomaly at the end of leap years.
>
>
> 0 1 * * * /usr/bin/ksh -c '[ $(($(date '+\%j') \% 28)) -eq 0 ] &&
> /path/to/my/job/the_job'

   %j day of year (001..366)

Two problems are not adjusting the initial start date
(simple enough, adding a constant) and 365 % 28 != 0.
The last will give you an extended period once per
year. The only reliable way to handle this requries
gnu date, which has %s == system time in GMT:

[ $(( ($(date +%s) + $INITIAL_DATE_OFFSET) % 2419200 )) -eq 0 ] &&
/blah;

Is a bit grimy but works. The wallclock time may shift
slightly during the DST correction but the basic interval
works.

The one-second resolution can cause problems if crond
doesn't run exactly on the minute; this can be corrected
by taking the integer portion after dividing by 60 and
comparing that.

At which point it's better to give up on cron entirely
and use at, which does all of this mess for you and
handles cron outages also (which the above doesn't).

--
Steven Lembark  2930 W. Palmer
Workhorse Computing  Chicago, IL 60647
   +1 800 762 1582
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).





-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: Unix - scheduling - I know this, it's a UNIX system

2002-07-03 Thread lembark



-- [EMAIL PROTECTED] on 07/03/02 14:13:30 -0800

> 
> This will run the job every 28 daze at 1am.  If that's not exactly the
> definition of every 4th week let me know and I'll work something out.  Also
> note that you will have an anomaly at the end of leap years.
> 
> 
> 0 1 * * * /usr/bin/ksh -c '[ $(($(date '+\%j') \% 28)) -eq 0 ] &&
> /path/to/my/job/the_job'

   %j day of year (001..366)

Two problems are not adjusting the initial start date 
(simple enough, adding a constant) and 365 % 28 != 0.
The last will give you an extended period once per
year. The only reliable way to handle this requries
gnu date, which has %s == system time in GMT:

[ $(( ($(date +%s) + $INITIAL_DATE_OFFSET) % 2419200 )) -eq 0 ] && /blah;

Is a bit grimy but works. The wallclock time may shift
slightly during the DST correction but the basic interval
works.

The one-second resolution can cause problems if crond
doesn't run exactly on the minute; this can be corrected
by taking the integer portion after dividing by 60 and 
comparing that.

At which point it's better to give up on cron entirely 
and use at, which does all of this mess for you and 
handles cron outages also (which the above doesn't).

--
Steven Lembark  2930 W. Palmer
Workhorse Computing  Chicago, IL 60647
   +1 800 762 1582
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: Unix - scheduling - I know this, it's a UNIX system

2002-07-03 Thread Brian_P_MacLean


This will run the job every 28 daze at 1am.  If that's not exactly the
definition of every 4th week let me know and I'll work something out.  Also
note that you will have an anomaly at the end of leap years.


0 1 * * * /usr/bin/ksh -c '[ $(($(date '+\%j') \% 28)) -eq 0 ] &&
/path/to/my/job/the_job'







   
 
  Roland.Skoldblom@
 
  ica.se   To:   Multiple recipients of list 
ORACLE-L <[EMAIL PROTECTED]>
  Sent by: cc: 
 
  [EMAIL PROTECTED] Subject:  Unix - scheduling 
 
   
 
   
 
  07/02/02 01:43 AM
 
  Please respond to
 
  ORACLE-L 
 
   
 
   
 




Hallo,

anyone who has a good example on how to write in the crontab if you want to
schedule a job to run every four week.
Is it possible to do that in unix cron job schedule.

Thanks in advance


Roland

--






-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).