From eeafdff7302310aa1879fe75f57b65947bf22625 Mon Sep 17 00:00:00 2001 From: Paul Gideon Dann Date: Fri, 18 Feb 2011 17:41:11 +0000 Subject: [PATCH 2/2] Only resynchronize if there are no running jobs, to avoid running @hourly jobs twice. --- main.c | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index f8d119e..0d189d6 100644 --- a/main.c +++ b/main.c @@ -326,10 +326,19 @@ main(int ac, char **av) */ if (--rescan == 0) { - rescan = 60; - SynchronizeDir(CDir, NULL, 0); - SynchronizeDir(SCDir, "root", 0); - ReadTimestamps(NULL); + /** + * If we resynchronize whilst jobs are running, we'll clobber + * the job PIDs, so we won't know what's already running, and + * we'll end up running jobs twice :s + */ + if (CheckJobs() > 0) { + rescan = 1; + } else { + rescan = 60; + SynchronizeDir(CDir, NULL, 0); + SynchronizeDir(SCDir, "root", 0); + ReadTimestamps(NULL); + } } else { CheckUpdates(CDir, NULL, t1, t2); CheckUpdates(SCDir, "root", t1, t2); -- 1.7.4.1