0

I have written the following shell script

#!/bin/bash
#s3 bucket name
export AWS_PROFILE=tahashin
S3_BUCKET="oa-eui-dev-plt-env-kpidev-oa"
export jmsxfilename=$1
testconfigfolder="$S3_BUCKET/loadtest/TestConfiguration"
propertiesfile=testconfig.properties
jmetertestfolder="$S3_BUCKET/loadtest/testscripts"
#download test configuration file
echo "Downloading configuration and jmx file"
aws s3 cp s3://$testconfigfolder/$propertiesfile Test_configuration/
aws s3 cp s3://$jmetertestfolder/$jmsxfilename Tests_folder/
#set filename
varsFilename="Test_configuration/$propertiesfile"
scriptname="Tests_folder/$jmsxfilename"
#set env variable using csv file
#declare host,schema,Bearer,Customer_Universe,Consent
#count=0
#while IFS=, read -r name value; 
#do
# echo "Name and value of the variable  is : $name $value"
#((++count))
#done < <(tail -n +2 $varsFilename)

#set Jmeter configuration
resultfile=$(echo $scriptname | sed -e s~\.jmx )

#run jmeter script
echo "Jmeter test starting"
D:/apache-jmeter-5.4.1/bin/jmeter.sh -q $varsFilename -n -t $scriptname -l results/results.csv
echo "Jmeter test finished"
sudo rm -rf Test_configuration/$varsFilename
read -p "Press any key to resume ..."

The purpose of writing this shell script is: jmx and properties file will be s3. Jmx file will be executed in a docker container using aws fargate. Fargate will be created by aws batch job. But after a while trying to execute this script in my local windows machine, I am getting following error error

2 Answers2

0

If sudo is available on your system, then probably it's not located in your PATH. Run this:

export PATH="${PATH}:/usr/bin"

You can verify which path to add by running one of the commands below.

$ which sudo
/usr/bin/sudo
$ whereis sudo
sudo: /usr/bin/sudo /usr/lib/sudo /usr/share/man/man8/sudo.8.gz
Bayou
  • 3,293
  • 1
  • 9
  • 22
0
  1. I don't think sudo command exists in Git Bash, if you really need it for anything - consider installing win-sudo however I don't see any sense in it, you can just remove it.

  2. You need to have java.exe in your PATH so add something like:

    PATH=$PATH:/c/Program\ Files/Common\ Files/Oracle/Java/bin
    

    to the script you "have written"

    The same applies to all the variables, either surround them with quotation marks or make sure that all characters which need escaping are escaped with the back slash like in the above example

More information: Get Started With JMeter: Installation & Tests

Dmitri T
  • 159,985
  • 5
  • 83
  • 133