Merge pull request #17 from lispmachine/wait-fix

Stop container if nginx stops
This commit is contained in:
Elliot Saba 2020-02-05 12:24:29 -08:00 committed by GitHub
commit 59e451c614
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -35,6 +35,13 @@ while [ true ]; do
sleep 604810 & sleep 604810 &
SLEEP_PID=$! SLEEP_PID=$!
# Wait on sleep so that when we get ctrl-c'ed it kills everything due to our trap # Wait for 1 week sleep or nginx
wait "$SLEEP_PID" wait -n $SLEEP_PID $NGINX_PID
# Make sure we do not run container empty (without nginx process).
# If nginx quit for whatever reason then stop the container.
# Leave the restart decision to the container orchestration.
if ! jobs | grep --quiet nginx ; then
exit 1
fi
done done