[ https://issues.apache.org/jira/browse/NIFI-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15271103#comment-15271103 ]
ASF GitHub Bot commented on NIFI-1812: -------------------------------------- Github user alopresto commented on a diff in the pull request: https://github.com/apache/nifi/pull/386#discussion_r62085710 --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh --- @@ -211,9 +211,9 @@ run() { # run 'start' in the background because the process will continue to run, monitoring NiFi. # all other commands will terminate quickly so want to just wait for them if [ "$1" = "start" ]; then - (cd "${NIFI_HOME}" && ${sudo_cmd_prefix} "${JAVA}" -cp "${BOOTSTRAP_CLASSPATH}" -Xms12m -Xmx24m -Dorg.apache.nifi.bootstrap.config.file="${BOOTSTRAP_CONF}" org.apache.nifi.bootstrap.RunNiFi $@ &) + (cd "${NIFI_HOME}" && ${sudo_cmd_prefix} "${JAVA}" -cp "${BOOTSTRAP_CLASSPATH}" -Xms12m -Xmx24m -Dorg.apache.nifi.bootstrap.config.log.dir="${NIFI_LOG_DIR}" -Dorg.apache.nifi.bootstrap.config.pid.dir="${NIFI_PID_DIR}" -Dorg.apache.nifi.bootstrap.config.file="${BOOTSTRAP_CONF}" org.apache.nifi.bootstrap.RunNiFi $@ &) else - (cd "${NIFI_HOME}" && ${sudo_cmd_prefix} "${JAVA}" -cp "${BOOTSTRAP_CLASSPATH}" -Xms12m -Xmx24m -Dorg.apache.nifi.bootstrap.config.file="${BOOTSTRAP_CONF}" org.apache.nifi.bootstrap.RunNiFi $@) + (cd "${NIFI_HOME}" && ${sudo_cmd_prefix} "${JAVA}" -cp "${BOOTSTRAP_CLASSPATH}" -Xms12m -Xmx24m -Dorg.apache.nifi.bootstrap.config.log.dir="${NIFI_LOG_DIR}" -Dorg.apache.nifi.bootstrap.config.pid.dir="${NIFI_PID_DIR}" -Dorg.apache.nifi.bootstrap.config.file="${BOOTSTRAP_CONF}" org.apache.nifi.bootstrap.RunNiFi $@) fi --- End diff -- Since these two commands differ only by the trailing `&` to indicate a background process, can we store the long command in a variable once? This will reduce the effort to update in the future (forgetting to modify both lines). Something like: ``` RUN_CMD="cd \"${NIFI_HOME}\" && ${sudo_cmd_prefix} \"${JAVA}\" -cp \"${BOOTSTRAP_CLASSPATH}\" -Xms12m -Xmx24m -Dorg.apache.nifi.bootstrap.config.log.dir=\"${NIFI_LOG_DIR}\" -Dorg.apache.nifi.bootstrap.config.pid.dir=\"${NIFI_PID_DIR}\" -Dorg.apache.nifi.bootstrap.config.file=\"${BOOTSTRAP_CONF}\" org.apache.nifi.bootstrap.RunNiFi \"$@\"" if [ "$1" = "start" ]; then ("$RUN_CMD" &) else ("$RUN_CMD") fi ``` > Add nifi-env script > -------------------- > > Key: NIFI-1812 > URL: https://issues.apache.org/jira/browse/NIFI-1812 > Project: Apache NiFi > Issue Type: Improvement > Reporter: Yolanda M. Davis > Fix For: 1.0.0 > > > The nifi-env script should be created for use by nifi startup, status and > shutdown scripts to set env variables like JAVA_HOME, location of log dir, > location of pid dir etc. This makes it easier to manage these locations in a > single script. For example currently the path to java is set in > bootstrap.conf however if your system does not have JAVA_HOME set or java in > path the nifi start command fails (so the user has to explicitly set > JAVA_HOME or PATH before invoking nifi start). -- This message was sent by Atlassian JIRA (v6.3.4#6332)