Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not fork a process for a condition check #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ echoerr() { printf "%(%FT%TZ)T %s\n" -1 "$*" >&2; }
nginx -t -g 'daemon off;' || ( echoerr "Nginx configuration test failed" && exit 1 )

#Run nginx graceful autoreload check in background
[[ $AUTORELOAD ]] && (
sleep 1
if [[ $AUTORELOAD ]]
then
(sleep 1
[[ "$AUTORELOAD_CHECK_METHOD" = "timestamp" ]] && CHECK_METHOD='timestamp' || CHECK_METHOD='checksum'

echoerr "Autoreload: Waiting for ${AUTORELOAD_CHECK_FILE:=/etc/nginx/nginx.conf} changes to autoreload nginx." \
Expand All @@ -44,6 +45,7 @@ nginx -t -g 'daemon off;' || ( echoerr "Nginx configuration test failed" && exit
nginx -t && nginx -s reload
fi
done
) &
) &
fi

exec nginx -g 'daemon off;'