Skip to content

Instantly share code, notes, and snippets.

@joshuakfarrar
Forked from allgood2386/ab test script
Last active December 14, 2015 19:19
Show Gist options
  • Save joshuakfarrar/5136155 to your computer and use it in GitHub Desktop.
Save joshuakfarrar/5136155 to your computer and use it in GitHub Desktop.
#!/bin/bash
# This script will run a series of ab benchmarks and print them out to a files directory in a drupal site with the -w
# flag for easy web browser reading.
# Example usage:
# ./thisScript.sh -u 'ourpassword:todev' -d http://somedomain.com -o dir/towrite/to -f 'index/ something.php /content/node/xxxx/'
while getopts u:d:o:f: option
do
case "${option}"; in
u) USER=${OPTARG};;
d) DOMAIN=${OPTARG};;
o) OUTDIR=${OPTARG};;
f) FILES=${OPTARG};;
esac
done
for FILE in "$FILES"
do
if [ ! -f $OUTDIR/$FILE.perf.html]; then
touch $OUTDIR/$FILE.perf.html
if [$? == 1]; then
echo 'Cannot create a file at the set path. Check file permissions or setsudo bit.'
exit 1
fi
fi
for i in 1 2 4 8 16 20 30 40
do
TARGETDOM="$DOMAIN\\$FILE"
ab -A "$USER" -w -n 1000 -c $i $TARGETDOM >> $OUTDIR/$FILE.perf.html
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment