mirror of
https://github.com/fradelg/docker-mysql-cron-backup.git
synced 2024-11-01 00:21:46 +01:00
Merge pull request #94 from g-nardiello/feature-healthcheck
[Feature] Add basic healthcheck
This commit is contained in:
commit
19c7f7395d
3 changed files with 12 additions and 1 deletions
|
@ -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 /HEALTHY.status || exit 1
|
||||
|
||||
ENTRYPOINT dockerize -wait tcp://${MYSQL_HOST}:${MYSQL_PORT} -timeout ${TIMEOUT} /run.sh
|
|
@ -13,6 +13,12 @@ docker container run -d \
|
|||
fradelg/mysql-cron-backup
|
||||
```
|
||||
|
||||
### Healthcheck
|
||||
|
||||
|
||||
Healthcheck is provided as a basic init control.
|
||||
Container is **Healthy** after the database init phase, that is after `INIT_BACKUP` or `INIT_RESTORE_LATEST` happends without check if there is an error, **Starting** otherwise. Not other checks are actually provided.
|
||||
|
||||
## Variables
|
||||
|
||||
|
||||
|
|
2
run.sh
2
run.sh
|
@ -28,6 +28,8 @@ if [ -n "${EXIT_BACKUP}" ]; then
|
|||
trap final_backup SIGHUP SIGINT SIGTERM
|
||||
fi
|
||||
|
||||
touch /HEALTHY.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"
|
||||
|
|
Loading…
Reference in a new issue