From 99e69f0252ad727a187f2218fa9ca6a84782b5c2 Mon Sep 17 00:00:00 2001 From: Opher Shachar Date: Sat, 4 Apr 2020 15:50:24 +0300 Subject: [PATCH] NIFI-7318 - Allow 'docker stop' to gracefully shutdown As it is issuing 'docker stop' will immediatly exit the container. Signed-off-by: Pierre Villard This closes #4182. --- nifi-docker/dockerhub/sh/start.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nifi-docker/dockerhub/sh/start.sh b/nifi-docker/dockerhub/sh/start.sh index bd67c277e9..e4bc79a1dd 100755 --- a/nifi-docker/dockerhub/sh/start.sh +++ b/nifi-docker/dockerhub/sh/start.sh @@ -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}