-
-
Save infynyxx/741249 to your computer and use it in GitHub Desktop.
Add latency to localhost http://daniel.haxx.se/blog/2010/12/14/add-latency-to-localhost/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Copyright 2010 Eric Ryan Harrison <[email protected]> | |
# Inspired by: | |
# http://daniel.haxx.se/blog/2010/12/14/add-latency-to-localhost/ | |
if [ -n "$1" ] | |
then | |
if [ "$1" = "off" ] | |
then | |
tc qdisc del dev lo root | |
else | |
tc qdisc add dev lo root handle 1:0 netem delay $1msec | |
fi | |
else | |
echo 'Usage: localdelay [TIME_IN_MILLISECONDS|off]' | |
echo 'Example:' | |
echo ' localdelay 20' | |
echo ' This will add a 20 millisecond delay to localhost' | |
echo ' and pings will take 40+ms to respond.' | |
echo ' localdelay off' | |
echo ' Turns off delay.' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment