Skip to content

Instantly share code, notes, and snippets.

@reidrac
Created July 15, 2010 15:47
Show Gist options
  • Save reidrac/477139 to your computer and use it in GitHub Desktop.
Save reidrac/477139 to your computer and use it in GitHub Desktop.
#!/bin/bash
# CONFIGURATION
URL=http://127.0.0.1:8081/index.html
LOOPS=10
# DEFAULT
TIME=16
if [ $# -eq 1 ]; then
TIME=$1
fi
echo Runnig test with $TIME stop...
e=0
for i in `seq $LOOPS`; do
# wait the timeout to clean from previous test
sleep 20
FIRST=`curl -b "cookie=triple_chocolate" -i $URL 2>/dev/null | head -10 | grep "HTTP/1.1"`
sleep $TIME
SECOND=`curl -b "cookie=triple_chocolate" -i $URL 2>/dev/null | head -10 | grep "HTTP/1.1"`
# should be better, but first get won't fail, so...
if [ "X$FIRST" != "X$SECOND" ]; then
echo "$i loop: $SECOND"
e=$(($e+1))
fi
done
echo "$e error(s)"
echo 'done!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment