This is a simple shell script that replaces "Number of Threads" parameter in the original script, accepting it from the command line.
touch ./run_jmeter.sh
chmod +x ./run_jmeter.sh
And finally insert the code below into the file using your favorite editor.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Call this script with the Number of Threads parameter, e.g.: run_jmeter.sh 10 | |
echo "Preparing JMeter script" | |
sed "s#<stringProp name=\"ThreadGroup.num_threads\">.*#<stringProp name=\"ThreadGroup.num_threads\">$1</stringProp>#" all_pages.jmx > ./all_pages_converted.jmx | |
echo "Running JMeter script with $1 Threads" | |
jmeter -n -t all_pages_converted.jmx -l ./perf_test_results.jtl |