[techtalk] cron race

Nils Philippsen nils at wombat.dialup.fht-esslingen.de
Mon Jan 10 03:08:06 EST 2000


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
nils at wombat.dialup.fht-esslingen.de / nils at fht-esslingen.de / nils at redhat.de
   The use of COBOL cripples the mind; its teaching should, therefore, be
   regarded as a criminal offence.                  -- Edsger W. Dijkstra


************
techtalk at linuxchix.org   http://www.linuxchix.org




More information about the Techtalk mailing list