one.jmx文件带有命令行参数,因此我将长命令放在外壳程序脚本(RUN_GET_CALLS.sh)中运行one.jmx。现在我正在使用Two.jmx,它使用OS进程采样器通过shell脚本调用One.jmx。
当我执行Two.jmx时出现错误



timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect
1548833794770,4,"Patient_""_id""",500,"Exception occurred whilst executing system call: java.io.IOException: Cannot run program ""bash /home/ubuntu/HSDP_Suit/TestSuite/JMX_files/RUN_GET_CALLS.sh"" (in directory ""/home/ubuntu/JMeter/apache-jmeter-5.0/bin""): error=2, No such file or directory",Patient 1-4,text,false,,0,0,6,6,null,0,0,0





shell - 尝试在jmeter中使用OS进程采样器运行Shell脚本时出错-LMLPHP

我也尝试在“工作目录”框中放入路径,但它不起作用

最佳答案

您的语法有点不正确,应按以下方式配置OS Process Sampler


命令:/bin/bash
工作目录:/home/ubuntu/HSDP_Suit/TestSuite/JMX_files
参数1:-c
参数2:./RUN_GET_CALLS.sh ${PROPERTY_FILE} ${RESOURCE} ${PARAMETERS_STRING} ${FILE_NAME} ${RESULT_FILE}


配置屏幕截图示例:

shell - 尝试在jmeter中使用OS进程采样器运行Shell脚本时出错-LMLPHP

根据bash man page


  -c字符串
  
  如果存在-c选项,则从字符串读取命令。如果字符串后面有参数,则将其分配给位置参数,从$ 0开始。


更多信息:How to Run External Commands and Programs Locally and Remotely from JMeter

关于shell - 尝试在jmeter中使用OS进程采样器运行Shell脚本时出错,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54435402/

10-12 18:53