]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3470] unrelated: wait for "mariadb setup"/mysqld_safe to complete before restarting...
authorAndrei Pavel <andrei@isc.org>
Thu, 8 Aug 2024 09:15:48 +0000 (12:15 +0300)
committerAndrei Pavel <andrei@isc.org>
Thu, 8 Aug 2024 09:15:48 +0000 (12:15 +0300)
Attempt to fix `start-stop-daemon: /usr/bin/mysqld_safe is already running`

hammer.py

index aae1851c714db2291f170d84601a282486eab09c..bb9e885f7b14756c2868ac17ebe7114dc20df715 100755 (executable)
--- a/hammer.py
+++ b/hammer.py
@@ -1371,6 +1371,15 @@ ssl_key = {cert_dir}/kea-client.key
         execute('sudo sed -i "/^skip-networking$/d" /etc/my.cnf.d/mariadb-server.cnf')
         execute('sudo rc-update add mariadb')
         execute('sudo /etc/init.d/mariadb setup', raise_error=False)
+
+        # Wait for setup command to complete.
+        for i in range(10):
+            exit_code = execute('sudo pidof mysqld_safe', raise_error=False)
+            if exit_code != 0:
+                # Process exited or there was no process to begin with.
+                break
+            time.sleep(1)
+
         execute('sudo /etc/init.d/mariadb restart')
 
     cmd = "echo 'DROP DATABASE IF EXISTS keatest;' | sudo mysql -u root"