Skip to content

Commit

Permalink
[#3470] unrelated: wait for "mariadb setup"/mysqld_safe to complete b…
Browse files Browse the repository at this point in the history
…efore restarting mariadb in alpine

Attempt to fix `start-stop-daemon: /usr/bin/mysqld_safe is already running`
  • Loading branch information
andrei-pavel committed Aug 8, 2024
1 parent 04bd5f6 commit 64fddf7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hammer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,15 @@ def _configure_mysql(system, revision, features):
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"
Expand Down

0 comments on commit 64fddf7

Please sign in to comment.