Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

ExecuteStreamCommand Not Working

avatar
Contributor

Hi,

I am trying to move a file from local folder to another local folder using ExecuteStreamCommand after the success of previous processors.

I have added a file path of a bash script file. When ExecuteStreamCommand executes the script it throws error of "File or Directory does't exist".

Below is the command that I have written up in the bash script to move the file from one folder to antoher:

mv nifi-srcfiles/* BackupFiles/

source folder , target folder and bash script both lies in same directory.

When I run this command directly on command line, it successfully moves the file from one folder to another.

3 REPLIES 3

avatar
Super Mentor

@Muhammad Umar

You have to remember that NiFi is being run by some user and that user is running all these processor components. NiFi's base directory is not going to be the same directory as where you point to the script. Try passing the absolute directory path to the script inside of NiFi instead of just "nifi-srcfiles/*" and "BackupFiles/".

Thank you,

Matt

avatar
Contributor

@Matt

I tried using absolute path and it moved the file from one folder to another. But its also throwing an error even after moving the file. Below is the error I am facing:

2017-05-18 06:59:44,881 ERROR [Timer-Driven Process Thread-3] o.a.n.p.standard.ExecuteStreamCommand ExecuteStreamCommand[id=16239777-015c-1000-9a6d-2c5a189e47f1] Transferring flow file StandardFlowFileRecord[uuid=8eea8245-84a1-49f0-bc93-52be302ac069,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1495090525757-30, container=default, section=30], offset=619504, length=0],offset=0,name=Employee.csv,size=0] to output stream. Executable command /root/MoveFile.bash ended in an error: mv: cannot stat `/root/InputData/*': No such file or directory



avatar
Super Mentor
@Muhammad Umar

This Error is being thrown by your MoveFile.bash script and not by NiFi. NiFi is simply capturing the error response from the script and putting in tin the NiFi app log.

Thanks,

Matt