[techtalk] cron race

2000-01-09 Thread Kathy Hargreaves

Does anyone know if this crontab setup would be a race condition?

0 0 * * 7 /l/httpd/scripts/archive-logs --weekly
0 0 1 * * /l/httpd/scripts/archive-logs --monthly
0 0 1 1 * /l/httpd/scripts/archive-logs --yearly

On the days when two or more date conditions are met, I want the script
to run first with the ``weekly'' option, then with the ``monthly'' one,
then with the ``yearly'' one.  And I don't want to stagger the hours
because for each condition, I need to archive the logs right on that
boundary.


Thanks,
Kathy


[EMAIL PROTECTED]   http://www.linuxchix.org



Re: [techtalk] cron race

2000-01-09 Thread Kelly Lynn Martin

On Sun, 9 Jan 2000 18:58:04 -0500 (EST), Kathy Hargreaves <[EMAIL PROTECTED]> said:

>On the days when two or more date conditions are met, I want the script
>to run first with the ``weekly'' option, then with the ``monthly'' one,
>then with the ``yearly'' one.  And I don't want to stagger the hours
>because for each condition, I need to archive the logs right on that
>boundary.

My advice is to run a script daily, which then decides what to run (if
anything).  You will get race conditions with cron: there is no
guarantee that two jobs scheduled for the same time will run in any
particular order.

Kelly


[EMAIL PROTECTED]   http://www.linuxchix.org



Re: [techtalk] cron race

2000-01-09 Thread Nils Philippsen

On Sun, 9 Jan 2000, Kathy Hargreaves wrote:

> Does anyone know if this crontab setup would be a race condition?
> 
> 0 0 * * 7 /l/httpd/scripts/archive-logs --weekly
> 0 0 1 * * /l/httpd/scripts/archive-logs --monthly
> 0 0 1 1 * /l/httpd/scripts/archive-logs --yearly
> 
> On the days when two or more date conditions are met, I want the script
> to run first with the ``weekly'' option, then with the ``monthly'' one,
> then with the ``yearly'' one.  And I don't want to stagger the hours
> because for each condition, I need to archive the logs right on that
> boundary.

I think it would depend on th eprogram you issue (whether this handles
concurrent invocations gracefully). The docs that came with cron revealed
nothing intersting about that issue. Maybe you should write a wrapper for
the program that gets run every day, checking whether it's Sunday (and
issuing the weekly one), the first of a month (... monthly) or Jan 1st
(yearly).

That should be an easy one.

Nils
-- 
 Nils Philippsen / Berliner Straße 39 / D-71229 Leonberg // +49.7152.209647
[EMAIL PROTECTED] / [EMAIL PROTECTED] / [EMAIL PROTECTED]
   The use of COBOL cripples the mind; its teaching should, therefore, be
   regarded as a criminal offence.  -- Edsger W. Dijkstra



[EMAIL PROTECTED]   http://www.linuxchix.org