15 lines
714 B
Bash
Executable File
15 lines
714 B
Bash
Executable File
#!/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
|