Support Questions

Find answers, ask questions, and share your expertise
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Passing file name to bash script in nifi?

New Contributor

I am uncertain on how to pass the file name from the GetFile process to a bash script so that we can call clamAV on it.  I then need the result (success|failure) of the script passed back to nifi so we can route the flow. I can't seem to understand how to pass the arguments correctly or if I'm even using the correct process; ExecuteStreamCommand or ExecuteProcess.  We had an sys architect designing this with us but he left, leaving behind a very complicated non-working example.


I thought I had configured an ExecuteProcess correctly but it doesn't allow me to connect GetFile to it.


Expert Contributor

@phaelax   ExecuteScript ExecuteProcess ExecuteStreamCommand etc are some of the hardest configs in nifi.  It is very hard to give guidance without exact templates, configs, scripts, etc.   That said,  i would recommend ExecuteScript and python over bash.  If that is interesting to. you, you should spend some time consuming the 3 part series on ExecuteScript by @MattWho .   I believe the first part explains how to get flowfile attributes (filename) or flowfile content from previous processor flowfile (getFile) into the script.



@steven-matison That 3 part series on ExecuteScript was written by a very talented different Matt in this community  @mburgess.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.