Repository: nifi
Updated Branches:
  refs/heads/master 364efa96c -> 8d467f3d1


NIFI-3505: Fix nifi.sh restart

The 'exec' command added by NIFI-2689 affected restart behavior
negatively as 'exec' command will not execute subsequent commands in the
shell script.
This commit changes 'exec' is added only when 'run' is specified.

This closes #1523.

Signed-off-by: Aldrin Piri <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/8d467f3d
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/8d467f3d
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/8d467f3d

Branch: refs/heads/master
Commit: 8d467f3d1fe9b9e96e67f2979aa5676465afedc1
Parents: 364efa9
Author: Koji Kawamura <[email protected]>
Authored: Tue Feb 21 15:41:51 2017 +0900
Committer: Aldrin Piri <[email protected]>
Committed: Wed Feb 22 10:47:39 2017 -0500

----------------------------------------------------------------------
 .../nifi-resources/src/main/resources/bin/nifi.sh           | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/8d467f3d/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh
index 8834cbc..d827735 100755
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh
@@ -286,12 +286,19 @@ run() {
     
BOOTSTRAP_CONF_PARAMS="-Dorg.apache.nifi.bootstrap.config.file='${BOOTSTRAP_CONF}'"
 
     BOOTSTRAP_DIR_PARAMS="${BOOTSTRAP_LOG_PARAMS} ${BOOTSTRAP_PID_PARAMS} 
${BOOTSTRAP_CONF_PARAMS}"
-    run_nifi_cmd="exec '${JAVA}' -cp '${BOOTSTRAP_CLASSPATH}' -Xms12m -Xmx24m 
${BOOTSTRAP_DIR_PARAMS} org.apache.nifi.bootstrap.RunNiFi $@"
+
+    run_nifi_cmd="'${JAVA}' -cp '${BOOTSTRAP_CLASSPATH}' -Xms12m -Xmx24m 
${BOOTSTRAP_DIR_PARAMS} org.apache.nifi.bootstrap.RunNiFi $@"
+
     if [ -n "${run_as_user}" ]; then
       # Provide SCRIPT_DIR and execute nifi-env for the run.as user command
       run_nifi_cmd="sudo -u ${run_as_user} sh -c \"SCRIPT_DIR='${SCRIPT_DIR}' 
&& . '${SCRIPT_DIR}/nifi-env.sh' && ${run_nifi_cmd}\""
     fi
 
+    if [ "$1" = "run" ]; then
+      # Use exec to handover PID to RunNiFi java process, instead of foking it 
as a child process
+      run_nifi_cmd="exec ${run_nifi_cmd}"
+    fi
+
     if [ "$1" = "start" ]; then
         ( eval "cd ${NIFI_HOME} && ${run_nifi_cmd}" & )
     else

Reply via email to