I am trying to run script on remote computer using groovy in jsr223 sampler in jmeter. The problem that I do not get any response if the script success or not, or even if it success login or any indication. to be sure that this behavior occurred all the time, I created imaginary script and run it, and still nothing in response. here is the script
"c:/Program Files/PuTTY/plink.exe jenkins@174.257.244.157 -pw test!67 sudo /opt/mew/run_me.sh".execute().text
the server and the password are fake. but in the real script they are real. can someone please advise? the plink.exe destination is correct, if I use '\\' instead of '/' it failed so I just change the directions.
but their is no way to know what happened, I want to do it via code and with no jmeter sampler that I faced difficulties.
I can think of 3 reasons for not returning anything
174.257.244.157
to the SSH Known Hosts jenkins
user for sudo command execution, if this is the case add the jenkins
user to sudo
group and configure it to be able to run commands without prompting for password /opt/mew/run_me.sh
does/outputs nothing, try adding something like echo "Starting..."
to the beginning to have at least some output. Or substitute it with some command which is guaranteed to work like ls
or whoami
or date
In order to get more idea of what's going on you can amend your Groovy script to use ProcessBuilder class like:
new ProcessBuilder("c:/Program Files/PuTTY/plink.exe jenkins@174.257.244.157 -pw test!67 sudo /opt/mew/run_me.sh").inheritIO().start().text
More information: Apache Groovy - Why and How You Should Use It
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.