Skip to content

Instantly share code, notes, and snippets.

@rubo77
Last active February 21, 2018 23:01
Show Gist options
  • Select an option

  • Save rubo77/6f3abb42685237dfca16 to your computer and use it in GitHub Desktop.

Select an option

Save rubo77/6f3abb42685237dfca16 to your computer and use it in GitHub Desktop.
creates a defineable traffic, that looks like caused by real users
#!/usr/bin/env bash
# by rubo77: https://gist.github.com/rubo77/6f3abb42685237dfca16
# choose 5MB, 10MB, 20MB, 50MB, 100MB, 200MB, 512MB or 1GB
BIG=5MB
# choose the maximum download size for one recursive crawl, for example 100k or 2m
CRAWL_MAX=100k
IN="http://download.thinkbroadband.com/$BIG.zip http://google.de/?q=test http://www.bbc.co.uk http://www.theregister.co.uk http://en.wikipedia.org/wiki/cloud_computing"
mkdir -p /tmp/simulate/
cd /tmp/simulate/
while true; do
for x in $IN; do
echo downloading $x
wget -q -r -l 2 -Q$CRAWL_MAX -T 10 $x --wait 10 --random-wait --user-agent="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008092416 Firefox/3.0.3"
echo -n "["$(date "+%Y-%m-%d %H:%M:%S")"] - downloaded "
du /tmp/simulate/ -sh | cut -f1
rm /tmp/simulate/* -Rf
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment