From e8ce4afea0844564b61851266bc2ad85d556141e Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Thu, 5 Sep 2019 14:58:45 +0200 Subject: [PATCH] No sudo --- bin/bw | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/bin/bw b/bin/bw index 18ddf4c..7674bdc 100755 --- a/bin/bw +++ b/bin/bw @@ -1,26 +1,26 @@ #!/usr/bin/env bash unlimit() { - sudo tc qdisc del dev lo root + tc qdisc del dev lo root } limit() { if [ "$1" = "5Mbps" ]; then - sudo tc qdisc del dev lo root - sudo tc qdisc add dev lo handle 1: root htb default 11 - sudo tc class add dev lo parent 1:1 classid 1:11 htb rate 5000kbit - sudo tc qdisc add dev lo parent 1:11 handle 10: netem delay 38ms loss 0.09% + tc qdisc del dev lo root + tc qdisc add dev lo handle 1: root htb default 11 + tc class add dev lo parent 1:1 classid 1:11 htb rate 5000kbit + tc qdisc add dev lo parent 1:11 handle 10: netem delay 38ms loss 0.09% elif [ "$1" = "10Mbps" ]; then - sudo tc qdisc del dev lo root - sudo tc qdisc add dev lo handle 1: root htb default 11 - sudo tc class add dev lo parent 1:1 classid 1:11 htb rate 10000kbit - sudo tc qdisc add dev lo parent 1:11 handle 10: netem delay 32ms loss 0.09% + tc qdisc del dev lo root + tc qdisc add dev lo handle 1: root htb default 11 + tc class add dev lo parent 1:1 classid 1:11 htb rate 10000kbit + tc qdisc add dev lo parent 1:11 handle 10: netem delay 32ms loss 0.09% elif [ "$1" = "20Mbps" ]; then - sudo tc qdisc del dev lo root - sudo tc qdisc add dev lo handle 1: root htb default 11 - sudo tc class add dev lo parent 1:1 classid 1:11 htb rate 20000kbit - sudo tc qdisc add dev lo parent 1:11 handle 10: netem delay 25ms loss 0.09% + tc qdisc del dev lo root + tc qdisc add dev lo handle 1: root htb default 11 + tc class add dev lo parent 1:1 classid 1:11 htb rate 20000kbit + tc qdisc add dev lo parent 1:11 handle 10: netem delay 25ms loss 0.09% else echo -e >&2 "\x1B[31;1merror:\x1B[0m preset $1 not found" exit 1