From b034c0933c770f2d36c258747aa3c3c0ad2f519e Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Thu, 25 Feb 2010 09:48:26 -0500
Subject: [PATCH] Fixed: FS#1060 - multiple execution of Fetchmail / Getmail causes high load

---
 server/scripts/run-getmail.sh |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/server/scripts/run-getmail.sh b/server/scripts/run-getmail.sh
index 998ecab..274c0cb 100644
--- a/server/scripts/run-getmail.sh
+++ b/server/scripts/run-getmail.sh
@@ -8,6 +8,12 @@
 fi
 done
 #echo $rcfiles
-if [ "$rcfiles" != "" ]; then
-exec /usr/bin/getmail -n -v -g /etc/getmail $rcfiles
+if [ -f /tmp/.getmail_lock ]; then
+  echo 'Found getmail lock file /tmp/.getmail_lock, we quit here.'
+else
+  touch /tmp/.getmail_lock
+  if [ "$rcfiles" != "" ]; then
+    exec /usr/bin/getmail -n -v -g /etc/getmail $rcfiles
+  fi
+  rm -f /tmp/.getmail_lock
 fi
\ No newline at end of file

--
Gitblit v1.9.1