Sunday, February 17, 2008

Shell Script - wget.sh (Interactive)

Ever have that need to create as much load as possible on a web-server? Here is a little script I wrote today that will do it for you. You just need the URL. Its an interactive script so its easy to use. I will be making a non-interactive script soon. :)

Edit: To get the most out of this script, run it in multiple shells. Or, even better would be on multiple machines.



wget.sh



#! /bin/bash

clear
echo "--------------------------------"
echo "This script will wget get a url"
echo "over and over and over and over."
echo "--------------------------------"
echo "Enter address to create load on:"
read wgetit
echo "--------------------------------"
echo "Enter any wget options to pass:"
echo "(note: --delete-after is alreay used.)"
echo "(ex: --quiet for background use.)"
read wgetop
echo ""
echo "Ok..."
sleep 1

clear
echo "Does everything look right?"
echo "Address:"
echo $wgetit
echo ""
echo "Options:"
echo $wgetop
echo ""
echo "[y/n]"
read lookright
if [ $lookright = n ]
then
echo ""
echo "You fat-fingered it huh! Try again!"
echo ""
echo ""
exit
else
echo ""
echo "Good, lets start the 'load testing'."
echo "Don't forget, just kill the script when your done."
echo "(ex: ctrl+c)"
sleep 5
fi

while [ 1 -le 10 ]
do
clear
wget --delete-after $wgetop $wgetit
done

1 comment:

corndog said...

wget -q -O/dev/null is also pretty handy.