[Kolab-devel] [PATCH 1/2] Close existing slapd instances before launching 389 setup

Francesco Frassinelli fraph24 at gmail.com
Sat Aug 3 20:33:27 CEST 2013


---
 pykolab/setup/setup_ldap.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/pykolab/setup/setup_ldap.py b/pykolab/setup/setup_ldap.py
index b54fb55..5d97bf2 100644
--- a/pykolab/setup/setup_ldap.py
+++ b/pykolab/setup/setup_ldap.py
@@ -341,6 +341,13 @@ ServerAdminPwd = %(admin_pass)s
 
     log.info(_("Setting up 389 Directory Server"))
 
+    # Close existing instances
+    slapd_pid_file = '/var/run/dirsrv/slapd-kolab.pid'
+    if os.path.exists(slapd_pid_file):
+        with open(slapd_pid_file, 'r') as slapd_pid:
+            subprocess.Popen(['kill', slapd_pid.read().rstrip()])
+        time.sleep(5)
+
     setup_389 = subprocess.Popen(
             command,
             stdout=subprocess.PIPE,
-- 
1.8.3.1



More information about the devel mailing list