Re: What the heck is up with cron!?

From: Michael Tokarev (no email)
Date: Fri Mar 01 2002 - 05:39:53 EST


Joshua E Warchol wrote:
>
> This is only postfix related in that the result of
> my cron job is to make a map for postfix. But this list
> has more answers than just about anywhere, so here goes:

So prefix your subject with e.g. [OT] then... ;)

> I've got 10 servers all running redhat 7.0 and running
> vixie-cron 3.0.1. My cron job runs every minute, and is
> the only cron job run every minute. But every few minutes
> cron decides to run it at both n-1:59 and n:00. Here is
> a log clipping:
>
> Feb 28 20:24:00 tooheys CROND[12188]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:24:59 tooheys CROND[12276]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:25:00 tooheys CROND[12280]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:26:01 tooheys CROND[12380]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:27:00 tooheys CROND[12479]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:28:00 tooheys CROND[12570]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:29:00 tooheys CROND[12948]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:30:00 tooheys CROND[13051]: (postfix) CMD (build-localmail.sh)
> Feb 28 20:30:00 tooheys CROND[13052]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:31:00 tooheys CROND[13161]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:32:00 tooheys CROND[13234]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:33:01 tooheys CROND[13334]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:34:00 tooheys CROND[13691]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:34:59 tooheys CROND[13783]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:35:00 tooheys CROND[13786]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:36:00 tooheys CROND[13873]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:37:01 tooheys CROND[13962]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:38:00 tooheys CROND[14046]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:38:59 tooheys CROND[14394]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:39:00 tooheys CROND[14398]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:40:00 tooheys CROND[14480]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:41:00 tooheys CROND[14577]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:42:00 tooheys CROND[14677]: (postfix) CMD (build-blocklist.pl)
> Feb 28 20:43:00 tooheys CROND[14760]: (postfix) CMD (build-blocklist.pl)
>
> The command takes very little time to run, and with the use of a non-
> blocking exclusive lock I'm able to keep only one process touching the
> map file. So this isn't creating a big issue right now, except that
> everytime it runs twice I get an email from my software. That makes me
> sandy.
>
> So, oh wise and helpful postfixers :) Anyone ever run across a problem like
> this before?

Well, it's something new to me, and it seems bizzare. Do you by any chance
have problems with your system clock? Vixie-cron sleeps for 1 minute (using
gettimeofday+select), wakes up, queries system time and checks all it's queue,
runs every job found, queries systime again and sleeps for another minute.
Looking to the source, I can't see where it can be woken up at 59 sec.

Anyway, some suggestions.

It seems something is wrong with your locking. Try to debug your script
inserting some sleeps and running another copy while first one is running
(or remove any output in case of lock failure).

Are you sure you really need to update your blocklists that often? Usually,
it should be sufficient to update such things once every day, hour or e.g.
10 minutes (extreme!), but not every minute! This is a blocklist, after all!.. ;)

Also, for such frequent tasks, I'd write a daemon that will be running all the
time and will sleep by its own: update map, save timestamp, sleep, stat() a
file and compare a timestamp, sleep, stat()/compare, sleep, ... -- this way,
it is far more efficient, especially having in mind perl's startup time.

Regards,
 Michael.
-
To unsubscribe, send mail to with content
(not subject): unsubscribe postfix-users








Hosted Email Solutions

Invaluement Anti-Spam DNSBLs



Powered By FreeBSD   Powered By FreeBSD