Basically I am trying to write a script to stress test my server and ensure a command is running. My script is not working as intended. Below is the script. Basically the commands the script is executing are not being run asynchronously nor are their output being written to the results file. Any suggestions?
#Script to load test the swift command on a linux box
numOfTests=100
echo "Starting Swift Load Tester ($numOfTests iterations)"
mkdir /srv/www/htdocs/audiotest/stress_test
mkdir /srv/www/htdocs/audiotest/half_sec_test
mkdir /srv/www/htdocs/audiotest/sec_test
echo "This is the prompt text" > /srv/www/htdocs/audiotest/prompt.txt
echo "Beginning Stress Test..."
#Clear results text file
echo "" > results.txt
for((i=0; i < numOfTests; i++))
do
(time /opt/swift/bin/swift -n Allison-8kHz -o /srv/www/htdocs/audiotest/stress_test/$i.wav -f /srv/www/htdocs/audiotest/prompt.txt &) >> results.txt 2>&1
done
echo "Done"
echo "Beginning 1/2 second interval test..."
for((i=0; i< numOfTests; i++))
do
(time /opt/swift/bin/swift -n Allison-8kHz -o /srv/www/htdocs/audiotest/half_sec_test/$i.wav -f /srv/www/htdocs/audiotest/prompt.txt &) >> results.txt 2>&1
sleep .5
done
echo "Done"
echo "Beginning 1 second interval test..."
for((i=0; i< numOfTests; i++))
do
(time /opt/swift/bin/swift -n Allison-8kHz -o /srv/www/htdocs/audiotest/sec_test/$i.wav -f /srv/www/htdocs/audiotest/prompt.txt &) >> results.txt 2>&1
sleep 1
done
echo "Done"
echo "Load Testing Completed"