Added AUTOHEAL_START_PERIOD to delay the first health check

This commit is contained in:
Johann BERNEZ
2018-12-08 11:03:39 +01:00
parent ada5dfd023
commit b0d602ded1
2 changed files with 5 additions and 2 deletions
+2 -1
View File
@@ -24,12 +24,13 @@ b) Set ENV `AUTOHEAL_CONTAINER_LABEL=all` to watch all running containers.
c) Set ENV `AUTOHEAL_CONTAINER_LABEL` to existing label name that has the value `true`.
Note: You must apply `HEALTHCHECK` to your docker images first. See https://docs.docker.com/engine/reference/builder/#/healthcheck for details.
Note: You must apply `HEALTHCHECK` to your docker images first. See https://docs.docker.com/engine/reference/builder/#healthcheck for details.
## ENV Defaults
```
AUTOHEAL_CONTAINER_LABEL=autoheal
AUTOHEAL_INTERVAL=5 # check every 5 seconds
AUTOHEAL_START_PERIOD=0 # wait 0 second before first health check
DOCKER_SOCK=/var/run/docker.sock
```
+3 -1
View File
@@ -33,7 +33,9 @@ if [ "$1" = 'autoheal' ] && [ -e ${DOCKER_SOCK} ]; then
}
fi
echo "Monitoring containers for unhealthy status"
echo "Monitoring containers for unhealthy status in ${AUTOHEAL_START_PERIOD} second(s)"
sleep ${AUTOHEAL_START_PERIOD:=0}
while true; do
sleep ${AUTOHEAL_INTERVAL:=5}