summaryrefslogtreecommitdiffstats
path: root/hammer.py
diff options
context:
space:
mode:
authorAndrei Pavel <andrei@isc.org>2024-08-27 16:36:08 +0200
committerAndrei Pavel <andrei@isc.org>2024-08-29 06:43:24 +0200
commit0411c88f28f5dc4998856c6f550bb95b1985d328 (patch)
tree46cbf42018a3f45f9f22a100b2124ac605f5ba72 /hammer.py
parent[#3564] Bump up version in configure.ac to 2.7.3 (diff)
downloadkea-0411c88f28f5dc4998856c6f550bb95b1985d328.tar.xz
kea-0411c88f28f5dc4998856c6f550bb95b1985d328.zip
[#3559] hammer.py: pkill mariadb_safe before restarting
Attempt to fix `start-stop-daemon: /usr/bin/mysqld_safe is already running`
Diffstat (limited to 'hammer.py')
-rwxr-xr-xhammer.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/hammer.py b/hammer.py
index aa344e00e8..81fd964bd9 100755
--- a/hammer.py
+++ b/hammer.py
@@ -426,6 +426,15 @@ def execute(cmd, timeout=60, cwd=None, env=None, raise_error=True, dry_run=False
return exitcode
+def wait_for_process_to_start(process_name):
+ for _ in range(10):
+ exit_code = execute(f'sudo pidof {process_name}', raise_error=False)
+ if exit_code == 0:
+ # Process is there.
+ break
+ time.sleep(1)
+
+
def wait_for_process_to_exit(process_name):
for _ in range(100):
exit_code = execute(f'sudo pidof {process_name}', raise_error=False)
@@ -1380,10 +1389,11 @@ 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 rc-service mariadb stop')
+ wait_for_process_to_start('start-stop-daemon') # mysqld_safe
wait_for_process_to_exit('start-stop-daemon') # mysqld_safe
+ execute('sudo pkill -f mysqld_safe', raise_error=False) # If no graceful shutdown, force kill.
execute('sudo rc-service mariadb setup')
- wait_for_process_to_exit('start-stop-daemon') # mysqld_safe
- execute('sudo rc-service mariadb restart')
+ execute('sudo rc-service mariadb restart', raise_error=False)
cmd = "echo 'DROP DATABASE IF EXISTS keatest;' | sudo mysql -u root"
execute(cmd)