Reputation: 221
Im using the OS Process Sampler to execute the following shell command
cat ${myDataFile} | myProcessor.sh --param1 valueParam1 --param2 valueParam2
command: cat
Standard Input(stdin): ${myDataFile}
working directory: ${myHome}
command Parameters: | myProcessor.sh --param1 valueParam1 --param2 valueParam2
Response
cat: | myProcessor.sh --param1 valueParam1 --param2 valueParam2: No such file or directory
Clearly "cat" is tying to ca the command parameter as a file.
How to overcome this issue. This is running on a AWS EC2 environment
Upvotes: 0
Views: 598
Reputation: 168002
${myDataFile}
as a command Parameter, it shouldn't be simulating STDIN. See How to Run External Commands and Programs Locally and Remotely from JMeter article for more detailed explanation. echo $SHELL
command and read man
entries on your shell to learn how to do it.Upvotes: 0
Reputation: 157937
If you are using a pipe |
, you need to start the command in a shell:
bash -c "cat ${myDataFile} | myProcessor.sh --param1 valueParam1 --param2 valueParam2"
Your question leaves it open when ${myDataFile}
will get expanded. I assumed it will get expanded by jmeter. If it should get expanded at runtime, you need to use single quotes:
bash -c 'cat ${myDataFile} | myProcessor.sh --param1 valueParam1 --param2 valueParam2'
Upvotes: 1