diff --git a/data/Dockerfiles/watchdog/Dockerfile b/data/Dockerfiles/watchdog/Dockerfile index 457169de8..9eb883352 100644 --- a/data/Dockerfiles/watchdog/Dockerfile +++ b/data/Dockerfiles/watchdog/Dockerfile @@ -1,5 +1,4 @@ FROM alpine:3.6 - LABEL maintainer "André Peters " # Installation @@ -23,10 +22,12 @@ RUN apk add --update \ perl-socket6 \ perl-mime-lite \ perl-term-readkey \ + tini \ && curl https://raw.githubusercontent.com/mludvig/smtp-cli/v3.8/smtp-cli -o /smtp-cli \ && chmod +x smtp-cli COPY watchdog.sh /watchdog.sh +ENTRYPOINT ["/sbin/tini", "-g", "--"] # Less verbose CMD /watchdog.sh 2> /dev/null diff --git a/data/Dockerfiles/watchdog/tini b/data/Dockerfiles/watchdog/tini new file mode 100755 index 000000000..6556c966f Binary files /dev/null and b/data/Dockerfiles/watchdog/tini differ diff --git a/data/Dockerfiles/watchdog/watchdog.sh b/data/Dockerfiles/watchdog/watchdog.sh index 03b2b4fb0..470025de2 100755 --- a/data/Dockerfiles/watchdog/watchdog.sh +++ b/data/Dockerfiles/watchdog/watchdog.sh @@ -2,7 +2,6 @@ trap "exit" INT TERM trap "kill 0" EXIT -PARENT_PID=$$ # Prepare BACKGROUND_TASKS=() @@ -351,12 +350,12 @@ BACKGROUND_TASKS+=($!) ( while true; do for bg_task in ${BACKGROUND_TASKS[*]}; do - if ! kill -0 ${bg_task} 21>&2; then + if ! kill -0 ${bg_task} 1>&2; then echo "Worker ${bg_task} died, stopping watchdog and waiting for respawn..." log_to_redis "Worker ${bg_task} died, stopping watchdog and waiting for respawn..." - kill -TERM ${PARENT_PID} + kill -TERM 1 fi - sleep 1 + sleep 10 done done ) &