Browse Source

Do not start if msgq is already running.


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1087 e5f2f494-b856-4b98-b285-d166d9295462
Shane Kerr 15 years ago
parent
commit
b1881fc59d
1 changed files with 12 additions and 1 deletions
  1. 12 1
      src/bin/bind10/bind10.py.in

+ 12 - 1
src/bin/bind10/bind10.py.in

@@ -152,11 +152,22 @@ class BoB:
         Returns None if successful, otherwise an string describing the
         problem.
         """
+        # try to connect to the c-channel daemon, 
+        # to see if it is already running
+        c_channel_env = { "ISC_MSGQ_PORT": str(self.c_channel_port), }
+        if self.verbose:
+            sys.stdout.write("Checking for already running msgq\n")
+        # try to connect, and if we can't wait a short while
+        try:
+            self.cc_session = isc.cc.Session(self.c_channel_port)
+            return "msgq already running, cannot start"
+        except isc.cc.session.SessionError:
+            pass
+
         # start the c-channel daemon
         if self.verbose:
             sys.stdout.write("Starting msgq using port %d\n" % 
                              self.c_channel_port)
-        c_channel_env = { "ISC_MSGQ_PORT": str(self.c_channel_port), }
         try:
             c_channel = ProcessInfo("msgq", "msgq", c_channel_env, True)
         except Exception as e: