Added check if mysql is running, before it is started
authorRobert Harakaly <robert.harakaly@cern.ch>
Fri, 26 May 2006 12:24:22 +0000 (12:24 +0000)
committerRobert Harakaly <robert.harakaly@cern.ch>
Fri, 26 May 2006 12:24:22 +0000 (12:24 +0000)
org.glite.deployment.lb/config/scripts/glite-lb-config.py

index 7b3d37b..8b860d2 100644 (file)
@@ -115,18 +115,20 @@ python %s-config [OPTION...]""" % (self.name, os.environ['GLITE_LOCATION'], \
 
     def start(self):
 
-        print "Starting MySQL daemon                                     ",
-        errorcode = os.system("/usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid=/var/lib/mysql/%s.pid --max_allowed_packet=%s  &" \
-                               % (glib.fq_hostname,params['mysql.max_allowed_packet']))
-        time.sleep(5)
-        if errorcode:
-            glib.printFailedMessage()
-            return errorcode
-        else:
-            glib.printOkMessage()
-
-        if not os.path.exists('/tmp/mysql.sock'):
-            os.symlink('/var/lib/mysql/mysql.sock', '/tmp/mysql.sock')
+        pid = glib.getPID('mysqld_safe')
+        if pid == 0:        
+            print "Starting MySQL daemon                                     ",
+            errorcode = os.system("/usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid=/var/lib/mysql/%s.pid --max_allowed_packet=%s  &" \
+                                   % (glib.fq_hostname,params['mysql.max_allowed_packet']))
+            time.sleep(5)
+            if errorcode:
+                glib.printFailedMessage()
+                return errorcode
+            else:
+                glib.printOkMessage()
+    
+            if not os.path.exists('/tmp/mysql.sock'):
+                os.symlink('/var/lib/mysql/mysql.sock', '/tmp/mysql.sock')
             
         pid = glib.getPID('bkserverd')
         if pid != 0: