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 .

Signed-off-by: Aldrin Piri <aldrin@apache.org>
This commit is contained in:
Koji Kawamura 2017-02-21 15:41:51 +09:00 committed by Aldrin Piri
parent 364efa96cc
commit 8d467f3d1f
No known key found for this signature in database
GPG Key ID: 531AEBAA4CFE5D00
1 changed files with 8 additions and 1 deletions
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin

View File

@ -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