[Xymon] tasks.cfg - strange CRONDATE behaviour

Jeremy Laidman jlaidman at rebel-it.com.au
Tue Jun 3 08:34:05 CEST 2014


On Tuesday, 3 June 2014, Jeremy Laidman <jlaidman at rebel-it.com.au> wrote:

> Yep, when it drifted to 2 seconds after the minute mark I started seeing
> my script run twice.  When 3 seconds after the minute, it only runs once.
>  Although on one occasion when at 2 seconds past the minute, it only ran
> once.
>

Looks like a logic bug.  The code (xymonlaunch.c) runs a loop for all
tasks, with a 5 second sleep between each run, giving up to 12 loop cycles
per minute.  For CRONDATE entries, it refuses to run a task if the last
time the task was run was within 55 seconds of the current time.  That
opens up the possibility for a job to run at 1 second past the minute and
again at 57 minutes past the minute (or 58 or 59).  If the xymonlaunch loop
takes more than a 3/12 of a second, then at the end of 12 loop cycles, it
will be into the next minute.  But if it takes a little more time, it would
go back into that danger zone (57, 58 or 59 seconds) after only 11 cycles.

Seems to me that a better way would be, instead of seeing if the last run
timestamp was at least 55 seconds before now, check if the last run
timestamp "minute" was the same as now.  This could be easily implemented,
I would think, by seeing if int(laststart / 60) is equal to int(now/60).

J
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20140603/cbbacbb9/attachment.html>


More information about the Xymon mailing list