On Tuesday, 3 June 2014, Jeremy Laidman <<a href="mailto:jlaidman@rebel-it.com.au">jlaidman@rebel-it.com.au</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>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.</div>
</blockquote><div><br></div><div>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.</div>
<div><br></div><div>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).</div>
<div><br></div><div>J</div><div><br></div>