mirror of https://github.com/apache/nifi.git
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 <aldrin@apache.org>
This commit is contained in:
parent
364efa96cc
commit
8d467f3d1f
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue