NIFI-7318 - Allow 'docker stop' to gracefully shutdown

As it is issuing 'docker stop' will immediatly exit the container.

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #4182.
This commit is contained in:
Opher Shachar 2020-04-04 15:50:24 +03:00 committed by Pierre Villard
parent 8e9dbd7335
commit 99e69f0252
No known key found for this signature in database
GPG Key ID: BEE1599F0726E9CD
1 changed files with 3 additions and 2 deletions

View File

@ -87,11 +87,12 @@ case ${AUTH} in
esac
# Continuously provide logs so that 'docker logs' can produce them
tail -F "${NIFI_HOME}/logs/nifi-app.log" &
"${NIFI_HOME}/bin/nifi.sh" run &
nifi_pid="$!"
tail -F --pid=${nifi_pid} "${NIFI_HOME}/logs/nifi-app.log" &
trap "echo Received trapped signal, beginning shutdown...;" KILL TERM HUP INT EXIT;
trap 'echo Received trapped signal, beginning shutdown...;./bin/nifi.sh stop;exit 0;' TERM HUP INT;
trap ":" EXIT
echo NiFi running with PID ${nifi_pid}.
wait ${nifi_pid}