Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Passing file name to bash script in nifi?

avatar
Visitor

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.

2 REPLIES 2

avatar

@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.

 

https://community.hortonworks.com/articles/75032/executescript-cookbook-part-1.html

https://community.hortonworks.com/articles/75545/executescript-cookbook-part-2.html

https://community.hortonworks.com/articles/77739/executescript-cookbook-part-3.html

 

avatar
Master Mentor

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