I have a shell script with methods status()
and start()
. The code is below:
#function to check the jmeter processes running
status(){
PID=$(ps -ef | grep jmeter|grep -v grep)
echo "The jmeter processes running are: \n$PID"
}
#function to run the .jmx file given by the user at run time
start(){
echo "Please enter the file name .jmx extension"
read file
echo "Please enter the log file name .jtl extension"
read log_file
sh /home/ubuntu/apache-jmeter-3.0/bin/jmeter.sh -n -t $file -l $log_file &
}
while [ "$1" != "" ]; do
case "$1" in
start)
jmeter_start
;;
status)
jmeter_status
;;
*)
echo $"Usage: $0 {start|status}"
exit 1
esac
shift
done
now when I run this script, I have to check if it is already running and if it is running I have to exit. Let me know how to do this.
start
function? – Germanousstart
does not run in the background; it starts a different process in the background then immediately exists. – Ultramicrometer