[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15341861#comment-15341861 ] Joseph Witt commented on NIFI-2063: --- Ryan H via nifi.apache.org (sent by ryan.andrew.hendrick...@gmail.com) 10:21 AM (0 minutes ago) to dev I'm trying to get the 0.7.0 NiFi to start on boot on linux/centos 7. During all this, I've noticed 0.6.1 doesn't quite work either, left some notes at the bottom about that. *For 0.7.0:* *I followed the modified install commands for the nifi.sh script:* I untar'd it in: #/opt/nifi/current -> nifi-0.7.0-SNAPSHOT I followed these steps: ##Edited the nifi.sh script for the SCRIPT_DIR issue. #/opt/nifi/current/bin/nifi.sh install *#chkconfig nifi on <--- Turn on for boot 2345 run levels* #service nifi start NiFi is now started. I reboot the box. *NiFi does not start.* There's no logs in /var/log/messages or /opt/nifi/current/logs indicating why. (This script should probably log someplace) *Why?* The current script has a command that starts as: #cd ${NIFI_HOME} && sudo -u ${run_as} & The sudo part is omitted if there is no ${run_as} user defined. This works for starting the service by hand. However, if this script is set to start on boot with a ${run_as} user, in this case using chkconfig, it will silently fail when starting on boot because of the "sudo" part. Not sure why "sudo" isn't well liked in CentOS 7 in a service script. *How we fixed it:* Fixed by structuring the command like this the nifi.sh script like this: Old Command: ## RUN_NIFI_CMD="cd "\""${NIFI_HOME}"\"" && ${sudo_cmd_prefix} "\""${JAVA}"\"" -cp "\""${BOOTSTRAP_CLASSPATH}"\"" -Xms12m -Xmx24m ${BOOTSTRAP_DIR_PARAMS} org.apache.nifi.bootstrap.RunNiFi" Put it into the if's: #if [ "$1" = "start" ]; then #RUN_NIFI_CMD="su -c "\""cd "\""${NIFI_HOME}"\"" && "\""${JAVA}"\"" -cp "\""${BOOTSTRAP_CLASSPATH}"\"" -Xms12m -Xmx24m ${BOOTSTRAP_DIR_PARAMS} org.apache.nifi.bootstrap.RunNiFi $@ &"\"" ${run_as}" #(eval $RUN_NIFI_CMD) #else #RUN_NIFI_CMD="su -c "\""cd "\""${NIFI_HOME}"\"" && "\""${JAVA}"\"" -cp "\""${BOOTSTRAP_CLASSPATH}"\"" -Xms12m -Xmx24m ${BOOTSTRAP_DIR_PARAMS} org.apache.nifi.bootstrap.RunNiFi $@"\"" ${run_as}" #(eval $RUN_NIFI_CMD) #fi It now starts on boot. *Logging in this file:* * I created a /var/log/nifi dir as root * I started piping echo statements to "tee -a /var/log/nifi/init.log" ** *Example: #echo "Attempting to start NiFi" | tee -a /var/log/nifi/init.log *For 0.6.1:* *I followed the standard install commands for the nifi.sh script.* I untar'd it in: #/opt/nifi/current -> nifi-0.7.0-SNAPSHOT I followed these steps: #/opt/nifi/current/bin/nifi.sh install *#chkconfig nifi on <--- Turn on for boot 2345 run levels* #service nifi start NiFi is now started. I reboot the box. *NiFi does not start.* There's no logs in /var/log/messages or /opt/nifi/current/logs indicating why. (This script should probably log someplace) *Why?* The current script has a command that starts as: #cd ${NIFI_HOME} && sudo -u ${run_as} & The sudo part is omitted if there is no ${run_as} user defined. This works for starting the service by hand. However, if this script is set to start on boot with a ${run_as} user, in this case using chkconfig, it will silently fail when starting on boot because of the "sudo" part. Not sure why "sudo" isn't well liked in CentOS 7 in a service script. *How we fixed it:* Fixed by structuring the command like this: #su -c "cd ${NIFI_HOME} && &" ${run_as} This works when starting on boot if you have a ${run_as} user defined, though not sure of the behavior if there is no ${run_as} user defined or if the ${run_as} user is root. -- Thanks, Ryan > 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 > 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, w
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15342342#comment-15342342 ] ASF GitHub Bot commented on NIFI-2063: -- GitHub user YolandaMDavis opened a pull request: https://github.com/apache/nifi/pull/553 NIFI-2063 - correct service installation problems with nifi-env.sh Made changes to ensure proper execution of nifi.sh install: 1) added cp command of nifi_env.sh to /etc/init.d so it can be executed by /etc/init.d/nifi 2) Ensured the NIFI_HOME is properly corrected in /etc/init.d/nifi_env.sh Test of service install, manual start and stop, was done on vagrant vm with centos7.0. Reboot startup was checked using chkconfig command (**chckconfig nifi on**) and then restarting the vm. With the service installation correction the issue noted on reboot was not observed so further testing may be required. You can merge this pull request into a Git repository by running: $ git pull https://github.com/YolandaMDavis/nifi NIFI-2063 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/553.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #553 commit 124693c966f466a8d9783209eafb025450e4a5a2 Author: Yolanda M. Davis Date: 2016-06-21T16:23:10Z NIFI-2063 - correct service installation problems with nifi-env.sh > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15342370#comment-15342370 ] ASF GitHub Bot commented on NIFI-2063: -- Github user YolandaMDavis commented on the issue: https://github.com/apache/nifi/pull/553 Some screen shoots of testing update on vagrant vm ![nifi_install_start](https://cloud.githubusercontent.com/assets/1371858/16241243/d26e9d74-37ba-11e6-88d5-705b0d9767bc.jpg) ![nifi_manual_start](https://cloud.githubusercontent.com/assets/1371858/16241244/d2774686-37ba-11e6-9e8e-d6e7a8a8ea0a.jpg) ![nifi_reboot_vagrant](https://cloud.githubusercontent.com/assets/1371858/16241242/d26e5cba-37ba-11e6-98e4-2d64ace43420.jpg) > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15342523#comment-15342523 ] ASF GitHub Bot commented on NIFI-2063: -- Github user jvwing commented on the issue: https://github.com/apache/nifi/pull/553 Reviewing > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15342524#comment-15342524 ] ASF GitHub Bot commented on NIFI-2063: -- Github user apiri commented on the issue: https://github.com/apache/nifi/pull/553 Reviewed this and tested with CentOS 7 and Debian jessie Docker images. This works as anticipated, but I have some concerns over duplicating the nifi-env.sh to colocate with the nifi.sh service after being installed. After installing the service, nifi-env.sh as part of the installation no longer has any effect on the application. In this case, if someone makes updates to the "bundled" nifi-env, they will not register. I think we need to constrain this to just one file or at least include the configuration with the default copy provided. > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15342527#comment-15342527 ] ASF GitHub Bot commented on NIFI-2063: -- Github user YolandaMDavis commented on the issue: https://github.com/apache/nifi/pull/553 @apiri I agree, I think we can do the latter, to ensure the configuration is added with the one copy. > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15342532#comment-15342532 ] ASF GitHub Bot commented on NIFI-2063: -- Github user jvwing commented on the issue: https://github.com/apache/nifi/pull/553 I agree with @apiri. I'm no expert on SysVInit, but I believe all of the files in the /etc/init.d/ directory are considered services, even nifi-env.sh. For example, running `service --status-all` will execute nifi-env.sh expecting it to be its own service. > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15342545#comment-15342545 ] ASF GitHub Bot commented on NIFI-2063: -- Github user YolandaMDavis commented on the issue: https://github.com/apache/nifi/pull/553 @jvwing thanks james for. Makes sense on all fronts. I'm working on an update now. > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15342590#comment-15342590 ] James Wing commented on NIFI-2063: -- I also have not experienced problems using NiFi 0.6.1, a run.as user configured in boostrap.conf, and rebooting. > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15344903#comment-15344903 ] ASF GitHub Bot commented on NIFI-2063: -- Github user jvwing commented on the issue: https://github.com/apache/nifi/pull/553 Thanks for the update, @YolandaMDavis. I tested this on Amazon Linux, and it worked well. Service installed, started, restarted after a reboot, stopped, etc. I was worried that the magic chkconfig comments in nifi.sh would not be picked up after the concatenation, but they seem to work when I manually adjusted them and then ran install. And thanks for the `chmod 755`, I used to do that manually. I'm hoping others will review and/or test. I plan to merge this later today unless somebody stops me. > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15344914#comment-15344914 ] ASF GitHub Bot commented on NIFI-2063: -- Github user apiri commented on the issue: https://github.com/apache/nifi/pull/553 Looks like the current commit will currently disregard nifi-env.sh after being installed. Consider the case where I install the service and then later switch JRE (perhaps between Oracle and Open JDK). The service, in this scenario, will still use the JRE specified at the time of install. This could be confusing for users when they make changes in their installed nifi-env.sh but they do not get used. I think we should shoot for a version that allows a user to make changes locally and not have the installed service make use of them. > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15344932#comment-15344932 ] ASF GitHub Bot commented on NIFI-2063: -- GitHub user apiri opened a pull request: https://github.com/apache/nifi/pull/561 NIFI-2063 Adjusting handling of service install by using script that … …delegates to installed nifi.sh at NIFI_HOME. Only prohibit installation of service for Cygwin and Darwin environments that are guaranteed to not support it. This is an alternative approach the work of #553 which will delegate service calls to the core nifi.sh and the associated nifi-env.sh. You can merge this pull request into a Git repository by running: $ git pull https://github.com/apiri/incubator-nifi linux-service Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/561.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #561 commit 11985a05dac703f7374ed13d9e403c8956e7b4c9 Author: Aldrin Piri Date: 2016-06-22T17:09:40Z NIFI-2063 Adjusting handling of service install by using script that delegates to installed nifi.sh at NIFI_HOME. Only prohibit installation of service for Cygwin and Darwin environments that are guaranteed to not support it. > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15344935#comment-15344935 ] ASF GitHub Bot commented on NIFI-2063: -- Github user YolandaMDavis closed the pull request at: https://github.com/apache/nifi/pull/553 > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15344934#comment-15344934 ] ASF GitHub Bot commented on NIFI-2063: -- Github user YolandaMDavis commented on the issue: https://github.com/apache/nifi/pull/553 @jvwing @apiri closing out this PR, @apiri has a version coming. > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15344936#comment-15344936 ] ASF GitHub Bot commented on NIFI-2063: -- Github user apiri commented on the issue: https://github.com/apache/nifi/pull/553 Hey @jvwing, I created a PR with how I envisioned it running such that users can make changes without issue in the installed versions. This is available in #561 > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15345238#comment-15345238 ] ASF GitHub Bot commented on NIFI-2063: -- Github user jvwing commented on the issue: https://github.com/apache/nifi/pull/561 @apiri, I ran into an error executing the script: ``` # bin/nifi.sh install bin/nifi.sh: line 304: syntax error: unexpected end of file ``` This appears to be caused by the `... || { echo "..."; exit 1}` clauses on lines 202 and 204. I'm not sure exactly why. Have you considered using the `die()` function defined above? > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15345267#comment-15345267 ] ASF GitHub Bot commented on NIFI-2063: -- Github user jvwing commented on a diff in the pull request: https://github.com/apache/nifi/pull/561#discussion_r68144940 --- 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 -- Is the 4 + 8 indentation purposeful? It appears inconsistent between lines 144-145, 150, 157-158, and 194-195. > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15345487#comment-15345487 ] ASF GitHub Bot commented on NIFI-2063: -- Github user apiri commented on the issue: https://github.com/apache/nifi/pull/561 @jvwing Drat. I left off the semicolons. I was doing some adjustments in one of my VM instances and must not have propagated back to my core checkout. Will update that concerning the || conditionals. > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15345516#comment-15345516 ] ASF GitHub Bot commented on NIFI-2063: -- Github user apiri commented on the issue: https://github.com/apache/nifi/pull/561 Made those fixes and pushed them in a separate commit. Thanks for catching! Verified this script as committed in a Docker container as opposed to my prior Frankenscript and it seems to behave appropriately. > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15345698#comment-15345698 ] ASF GitHub Bot commented on NIFI-2063: -- Github user jvwing commented on the issue: https://github.com/apache/nifi/pull/561 The update looks good to me. I was able to install, start, stop, reboot, etc. No test or contrib-check issues. I will squash and merge shortly. Thanks @apiri for the script and @YolandaMDavis for getting this started. > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15345700#comment-15345700 ] ASF GitHub Bot commented on NIFI-2063: -- Github user asfgit closed the pull request at: https://github.com/apache/nifi/pull/561 > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15345699#comment-15345699 ] ASF subversion and git services commented on NIFI-2063: --- Commit baed85fa3d107ae1092556e4312e33b8a8e229b4 in nifi's branch refs/heads/master from [~aldrin] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=baed85f ] NIFI-2063 Adjusting handling of service install by using script that delegates to installed nifi.sh at NIFI_HOME. Prohibit installation of service for Cygwin and Darwin environments that are guaranteed to not support it. This closes #561 Signed-off-by: James Wing > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15345702#comment-15345702 ] ASF GitHub Bot commented on NIFI-2063: -- Github user apiri commented on the issue: https://github.com/apache/nifi/pull/561 @jvwing Thanks for scoping it out and apologies on the prior false start. > 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)
[jira] [Commented] (NIFI-2063) Install Script Relative Path Mismatch from Init Dir
[ https://issues.apache.org/jira/browse/NIFI-2063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15345712#comment-15345712 ] ASF subversion and git services commented on NIFI-2063: --- Commit 7b7788ef7c5019568c7c75d8626b79b97bb791b7 in nifi's branch refs/heads/0.x from [~aldrin] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=7b7788e ] NIFI-2063 Adjusting handling of service install by using script that delegates to installed nifi.sh at NIFI_HOME. Prohibit installation of service for Cygwin and Darwin environments that are guaranteed to not support it. This closes #561 Signed-off-by: James Wing > 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)