summaryrefslogtreecommitdiffstats
path: root/kolabd
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-11-30 11:59:30 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-11-30 11:59:30 +0000
commit3739ce13564137491d92b195c781c15b2f9b60b9 (patch)
treef15143eae7de8d1c9656a55d459656c3b0e5a83c /kolabd
parent5468b34206827efca734ec453d217c033f50ee2f (diff)
downloadpykolab-3739ce13564137491d92b195c781c15b2f9b60b9.tar.gz
Check if a domain name space synchronization process is still alive
try/except removing our PID file
Diffstat (limited to 'kolabd')
-rw-r--r--kolabd/__init__.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/kolabd/__init__.py b/kolabd/__init__.py
index 230088c..b345b8d 100644
--- a/kolabd/__init__.py
+++ b/kolabd/__init__.py
@@ -243,7 +243,11 @@ class KolabDaemon(object):
for domain in all_domains:
if domain in domain_auth.keys() and domain in primary_domains:
- continue
+ if not domain_auth[domain].is_alive():
+ domain_auth[domain].terminate()
+ added_domains.append(domain)
+ else:
+ continue
elif domain in domain_auth.keys():
removed_domains.append(domain)
else:
@@ -268,8 +272,19 @@ class KolabDaemon(object):
pass
def remove_pid(self, *args, **kw):
+ """
+ Remove our PID file.
+
+ Note that multiple processes can attempt to do this very same thing
+ at the same time, and therefore we need to test if the PID file
+ exists, and only try/except removing it.
+ """
if os.access(conf.pidfile, os.R_OK):
- os.remove(conf.pidfile)
+ try:
+ os.remove(conf.pidfile)
+ except:
+ pass
+
raise SystemExit
def set_signal_handlers(self):