基本上我正在尝试编写一个脚本来对我的服务器进行压力测试并确保命令正在运行。我的脚本没有按预期工作。下面是脚本。基本上,脚本正在执行的命令不会异步运行,也不会将它们的输出写入结果文件。有什么建议么?
#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"