Added file-based HEALTHCHECK

This commit is contained in:
g.nardiello 2023-01-05 11:55:04 +01:00
parent 3011a8770a
commit 39d39915e4
2 changed files with 6 additions and 1 deletions

View file

@ -41,4 +41,7 @@ RUN mkdir /backup && \
VOLUME ["/backup"]
CMD dockerize -wait tcp://${MYSQL_HOST}:${MYSQL_PORT} -timeout ${TIMEOUT} /run.sh
HEALTHCHECK --interval=2s --retries=1800 \
CMD stat /HEALTLY.status || exit 1
ENTRYPOINT dockerize -wait tcp://${MYSQL_HOST}:${MYSQL_PORT} -timeout ${TIMEOUT} /run.sh

2
run.sh
View file

@ -14,6 +14,8 @@ elif [ -n "${INIT_RESTORE_LATEST}" ]; then
find /backup -maxdepth 1 -name '*.sql.gz' | tail -1 | xargs /restore.sh
fi
touch /HEALTLY.status
echo "${CRON_TIME} /backup.sh >> /mysql_backup.log 2>&1" > /tmp/crontab.conf
crontab /tmp/crontab.conf
echo "=> Running cron task manager in foreground"