[ https://issues.apache.org/jira/browse/NIFI-3294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15871948#comment-15871948 ]
ASF GitHub Bot commented on NIFI-3294: -------------------------------------- Github user apiri commented on a diff in the pull request: https://github.com/apache/nifi/pull/1405#discussion_r101775516 --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh --- @@ -284,18 +281,21 @@ run() { # all other commands will terminate quickly so want to just wait for them #setup directory parameters - BOOTSTRAP_LOG_PARAMS="-Dorg.apache.nifi.bootstrap.config.log.dir="\""${NIFI_LOG_DIR}"\""" - BOOTSTRAP_PID_PARAMS="-Dorg.apache.nifi.bootstrap.config.pid.dir="\""${NIFI_PID_DIR}"\""" - BOOTSTRAP_CONF_PARAMS="-Dorg.apache.nifi.bootstrap.config.file="\""${BOOTSTRAP_CONF}"\""" + BOOTSTRAP_LOG_PARAMS="-Dorg.apache.nifi.bootstrap.config.log.dir=\"${NIFI_LOG_DIR}\"" + BOOTSTRAP_PID_PARAMS="-Dorg.apache.nifi.bootstrap.config.pid.dir=\"${NIFI_PID_DIR}\"" + 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="cd "\""${NIFI_HOME}"\"" && exec ${sudo_cmd_prefix} "\""${JAVA}"\"" -cp "\""${BOOTSTRAP_CLASSPATH}"\"" -Xms12m -Xmx24m ${BOOTSTRAP_DIR_PARAMS} org.apache.nifi.bootstrap.RunNiFi" + run_nifi_cmd="exec ${JAVA} -cp ${BOOTSTRAP_CLASSPATH} -Xms12m -Xmx24m ${BOOTSTRAP_DIR_PARAMS} org.apache.nifi.bootstrap.RunNiFi" + if [ -n "${run_as_user}" ]; then + # Provide SCRIPT_DIR to nifi-env for the run.as user + 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" = "start" ]; then - (eval $RUN_NIFI_CMD $@ &) + (eval "cd ${NIFI_HOME} && ${run_nifi_cmd}" &) else - eval $RUN_NIFI_CMD $@ + eval "cd ${NIFI_HOME} && ${run_nifi_cmd}" --- End diff -- yep, messed up the conflict resolution, thanks for catching. will adjust and submit. > NiFi will ignore nifi-env properties when running as another user > ----------------------------------------------------------------- > > Key: NIFI-3294 > URL: https://issues.apache.org/jira/browse/NIFI-3294 > Project: Apache NiFi > Issue Type: Bug > Components: Configuration > Affects Versions: 1.0.0, 0.7.0, 0.7.1, 1.1.1, 1.0.1 > Environment: All non-Windows, non-Cygwin OSes > Reporter: Aldrin Piri > Assignee: Aldrin Piri > Fix For: 0.8.0, 1.2.0 > > > nifi-env is a script that allows setting of certain properties external to > the core run scripts. However, when sudo is used, the resulting > subshell/child process is a separate environment that does not have the > needed information that was established in nifi-env. This needs to be > incorporated into the run command such that those properties are preserved. -- This message was sent by Atlassian JIRA (v6.3.15#6346)