[PHP-FPM] Plan a Postfix restart, when a MariaDB upgrade was applied

master
andryyy 2019-09-02 09:28:13 +02:00
parent 9c714b34a4
commit 49c7a2cbc7
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
1 changed files with 11 additions and 1 deletions

View File

@ -39,7 +39,17 @@ SQL_UPGRADE_RETURN=$(curl --silent --insecure -XPOST https://dockerapi/container
if [[ ${SQL_UPGRADE_RETURN} == 'warning' ]]; then if [[ ${SQL_UPGRADE_RETURN} == 'warning' ]]; then
if [ -z ${SQL_LOOP_C} ]; then if [ -z ${SQL_LOOP_C} ]; then
echo 1 > /mysql_upgrade_loop echo 1 > /mysql_upgrade_loop
echo "MySQL applied an upgrade, restarting PHP-FPM..." echo "MySQL applied an upgrade"
POSTFIX=($(curl --silent --insecure https://dockerapi/containers/json | jq -r '.[] | {name: .Config.Labels["com.docker.compose.service"], id: .Id}' | jq -rc 'select( .name | tostring | contains("postfix-mailcow")) | .id' | tr "\n" " "))
if [[ -z ${POSTFIX} ]]; then
echo "Could not determine Postfix container ID, skipping Postfix restart."
else
echo "Restarting Postfix"
curl -X POST --silent --insecure https://dockerapi/containers/${POSTFIX}/restart | jq -r '.msg'
echo "Sleeping 10 seconds..."
sleep 10
fi
echo "Restarting PHP-FPM, bye"
exit 1 exit 1
else else
rm /mysql_upgrade_loop rm /mysql_upgrade_loop