feat(mysql): Add config for reloads

This commit is contained in:
hygienic-books 2025-01-28 00:22:21 +01:00
parent d01155a616
commit c3ab8652d5
2 changed files with 15 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.idea

14
mysql_reload.sh Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
declare mysql_container="${1:?}"
if systemctl --quiet is-active docker.service; then
if [[ "$( docker container inspect -f '{{.State.Running}}' "${mysql_container}" 2> /dev/null )" == "true" ]]; then
if docker exec -t "${mysql_container}" bash -c 'mysqld --validate-config' &>/dev/null; then
docker restart "$(docker ps -qaf name="${mysql_container}")"
else
printf -- '%s\n' \
'MySQL config of container '"'${mysql_container}'"' does not validate.' \
'See: docker exec -t '"'${mysql_container}'"' bash -c '"'"'mysqld --validate-config'"'"'.' \
'We will leave the container running as-is.'
fi
fi
fi