Skip to content

Instantly share code, notes, and snippets.

@christos
Forked from zachinglis/gist:143695
Created September 6, 2010 21:33
Show Gist options
  • Save christos/567537 to your computer and use it in GitHub Desktop.
Save christos/567537 to your computer and use it in GitHub Desktop.
Make port 80 "real life" speeds
# Make port 80 "real life" speeds
# You can also use Mongrel ports.
function slow_port {
# Set the port variable if no port inputted. Defaulted to 80 (for Passenger).
if [ -z "$1" ]
then port=80
else port=$1
fi
# Slow the ports.
sudo ipfw pipe 1 config bw 15KByte/s
sudo ipfw add 1 pipe 1 src-port $port
sudo ipfw add 1 pipe 1 dst-port $port
echo "Port $port succesfully slowed."
}
function unslow_port {
sudo ipfw delete 1
echo "Port succesfully un-slowed."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment