Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Apache NiFI ExecuteStreamCommand Wrong Output

Apache NiFI ExecuteStreamCommand Wrong Output

Contributor

I have NiFi flow that runs some shell scripts using the ExecuteStreamCommand processor and the output of the ExecuteStreamCommand is not correct.

The Shell i run is:

if (( $(ps -ef | grep -v grep | grep kibana | wc -l) > 0 )); then echo "1"; else echo "0"; fi;

if the service is up then 1 if is down then 0, simple but the output is wrong, not matter is the service is up or down the output is always 1.

Here is a demo if the flow:

https://youtu.be/4e00rzerjSQ

2 REPLIES 2

Re: Apache NiFI ExecuteStreamCommand Wrong Output

@Adrian Oprea great video and that really helps eliminate a lot of questions. The result of this part of the command

$(ps -ef | grep -v grep | grep kibana | wc -l)

...does not appear to match when executed in the bash prompt versus the nifi environment. You might want to run only that part of the command in your script to see what it says in the attribute in NiFi. Also, you might want to ensure you're running in the shell you expect. You might want to have

#!/bin/bash

At the top of the script, for example.

Highlighted

Re: Apache NiFI ExecuteStreamCommand Wrong Output

Contributor

Hi,

I manage to get to the bottom of it at https://stackoverflow.com/questions/48985818/apache-nifi-executestreamcommand-wrong-output , @daggett he asked to set Ignore STDIN to true

This fixed my issue.

How ever this was not very self explanatory becouse i don`t know how and why would the output be changed?!

Don't have an account?
Coming from Hortonworks? Activate your account here