[
https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15345496#comment-15345496
]
ASF GitHub Bot commented on NIFI-2063:
--------------------------------------
Github user apiri commented on a diff in the pull request:
https://github.com/apache/nifi/pull/561#discussion_r68160177
--- Diff:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh
---
@@ -142,22 +138,72 @@ init() {
install() {
- SVC_NAME=nifi
- if [ "x$2" != "x" ] ; then
- SVC_NAME=$2
- fi
+ detectOS
- SVC_FILE="/etc/init.d/${SVC_NAME}"
- cp "$0" "${SVC_FILE}"
- sed -i s:NIFI_HOME=.*:NIFI_HOME="${NIFI_HOME}": "${SVC_FILE}"
- sed -i s:PROGNAME=.*:PROGNAME="${SCRIPT_NAME}": "${SVC_FILE}"
- rm -f "/etc/rc2.d/S65${SVC_NAME}"
- ln -s "/etc/init.d/${SVC_NAME}" "/etc/rc2.d/S65${SVC_NAME}"
- rm -f "/etc/rc2.d/K65${SVC_NAME}"
- ln -s "/etc/init.d/${SVC_NAME}" "/etc/rc2.d/K65${SVC_NAME}"
- echo "Service ${SVC_NAME} installed"
-}
+ if [ "${darwin}" = "true" ] || [ "${cygwin}" = "true" ]; then
+ echo 'Installing Apache NiFi as a service is not supported on OS X
or Cygwin.'
+ exit 1
+ fi
+
+ SVC_NAME=nifi
+ if [ "x$2" != "x" ] ; then
+ SVC_NAME=$2
+ fi
+
+ initd_dir='/etc/init.d'
+ SVC_FILE="${initd_dir}/${SVC_NAME}"
+
+ if [ ! -w "${initd_dir}" ]; then
+ echo "Current user does not have write permissions to
${initd_dir}. Cannot install NiFi as a service."
--- End diff --
It is not. Will also adjust.
> Install Script Relative Path Mismatch from Init Dir
> ---------------------------------------------------
>
> Key: NIFI-2063
> URL: https://issues.apache.org/jira/browse/NIFI-2063
> Project: Apache NiFi
> Issue Type: Bug
> Components: Configuration
> Affects Versions: 1.0.0, 0.7.0
> Environment: Linux/Unix with SysVInit
> Reporter: James Wing
> Assignee: Yolanda M. Davis
> Fix For: 0.7.0
>
>
> Ryan Hendrickson noticed that installing and running NiFi as a service in
> 0.7.0-SNAPSHOT is not working right. Running commands like the following:
> {code}
> $ sudo /opt/nifi/nifi-0.7.0-SNAPSHOT/bin/nifi.sh install
> Service nifi installed
> $ sudo service nifi start
> /etc/init.d/nifi: line 28: /etc/init.d/nifi-env.sh: No such file or directory
> {code}
> Results in errors loading nifi-env.sh
> *Used-To-Be*
> As I understand it, {{nifi.sh install}} used to:
> 1. copy bin/nifi.sh to /etc/init.d/nifi
> 2. Run sed to change NIFI_HOME initializations to the path to nifi.sh, where
> install was invoked
> 3. When {{service nifi start}} was run, the NIFI_HOME path was hard-coded in
> the service script file.
> *As-Is*
> 1. nifi.sh now gets NIFI_HOME from bin/nifi-env.sh, which is stored alongside
> nifi.sh.
> 2. install() still calls sed to update NIFI_HOME=, but the initialization is
> now in nifi-env.sh, so nothing is replaced.
> 3. When {{service nifi start}} is called, relative path to
> {{SCRIPT_DIR/nifi-env.sh}} resolves to {{/etc/init.d/nifi-env.sh}}, which
> does not exist.
> *To-Be*
> A possible solution might be to have sed update SCRIPT_DIR to be hard-coded,
> and change to that directory to run nifi-env.sh.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)