Skip to content

Instantly share code, notes, and snippets.

@speters
Created November 30, 2015 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save speters/f9af4298ca4f8c59fb3b to your computer and use it in GitHub Desktop.
Save speters/f9af4298ca4f8c59fb3b to your computer and use it in GitHub Desktop.
Simple web server "load testing" tool
#!/bin/bash
exit
NUM=25
#$1
#DEBUG="true"
PIDLIST=""
MYPID=$$
CURLINST=0
if [[ "$NUM" -gt 0 ]] ; then
for i in for i in `seq 1 ${NUM}`; do
if [[ "$DEBUG" = "true" ]]; then
echo $i curl -s "$CURL"
else
let "CURLINST+=1"
curl -D curlheads-$MYPID-$CURLINST.txt -c curlcookies-$MYPID-$CURLINST.txt -s 'http://www.banggood.example.com/index.php' -H 'Host: www.banggood.example.com' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Accept-Language: de-DE,de;q=0.8,en-US;q=0.5,en;q=0.3' --compressed -H 'DNT: 1' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'X-Requested-With: XMLHttpRequest' -H 'Cookie: __bguser= ; _bgLang=en-GB; currency=USD; is_old_customers=1; hotCatsId=140; COOKIE_SLAVE=178;' -H 'Referer: http://www.banggood.example.com/' -H 'Connection: keep-alive' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data 'quantity=1&products_id=1009664&botCat=1567&sku=SKU273457snapup&warehouse=CN&selPoa=POA560502&selAttrId=24&shipping=hkairmail_hkairmail&com=snapup&t=buyProduct&id%5B1%5D=24' | tee curlbody-$MYPID-$CURLINST.txt &
PIDLIST="$PIDLIST $!"
fi
done
fi
for job in $PIDLIST ; do
#echo $job
wait $job || let "FAIL+=1"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment