Github user apiri commented on a diff in the pull request:
https://github.com/apache/nifi/pull/675#discussion_r72243193
--- Diff:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh
---
@@ -265,20 +265,54 @@ run() {
BOOTSTRAP_DIR_PARAMS="${BOOTSTRAP_LOG_PARAMS} ${BOOTSTRAP_PID_PARAMS}
${BOOTSTRAP_CONF_PARAMS}"
RUN_NIFI_CMD="cd "\""${NIFI_HOME}"\"" && ${sudo_cmd_prefix}
"\""${JAVA}"\"" -cp "\""${BOOTSTRAP_CLASSPATH}"\"" -Xms12m -Xmx24m
${BOOTSTRAP_DIR_PARAMS} org.apache.nifi.bootstrap.RunNiFi"
+ LSB_EXIT_STATUS=0
+ LSB_NIFI_STATUS_TEMPFILE=`mktemp -t
LSB_NIFI_STATUS_TEMPFILE.XXXXXXXXXX`
if [ "$1" = "start" ]; then
(eval $RUN_NIFI_CMD $@ &)
else
- (eval $RUN_NIFI_CMD $@)
+ (eval $RUN_NIFI_CMD $@ "| tee "$LSB_NIFI_STATUS_TEMPFILE)
fi
# Wait just a bit (3 secs) to wait for the logging to finish and then
echo a new-line.
# We do this to avoid having logs spewed on the console after running
the command and then not giving
# control back to the user
sleep 3
echo
+ if [ "$1" = "status" ]; then
+ LSB_EXIT_STATUS= getLSBStatus
+ fi
+ return $LSB_EXIT_STATUS
}
+# Standard Status codes for LSB compliance
+# See:
http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
+# If the status action is requested, the init script will return the
following exit status codes.
+# 0 program is running or service is OK
+# 1 program is dead and /var/run pid file exists
+# 2 program is dead and /var/lock lock file exists
+# 3 program is not running
+# 4 program or service status is unknown
+# 5-99 reserved for future LSB use
+# 100-149 reserved for distribution use
+# 150-199 reserved for application use
+# 200-254 reserved
+
+getLSBStatus() {
+ LSB_EXIT_STATUS=4
+ if [ `grep -c "not.*running" ${LSB_NIFI_STATUS_TEMPFILE}` -gt 0 ]; then
--- End diff --
grep will return an exit code of 0 or 1 if the match is successful, don't
need to do the count
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---