diff options
author | Alon Levy <alevy@redhat.com> | 2011-09-04 18:44:50 +0300 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2011-09-04 18:44:50 +0300 |
commit | 99c9549a96bdb1e4c876cc0b9b52fe1aa57757c0 (patch) | |
tree | ca6efaac0c224eeeef5a94c96ce8e5cc73bf7a86 /test_bandwidth_limit | |
parent | 1e60f86302026184e9301ae6171654342458abc2 (diff) |
Diffstat (limited to 'test_bandwidth_limit')
-rwxr-xr-x | test_bandwidth_limit | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test_bandwidth_limit b/test_bandwidth_limit new file mode 100755 index 0000000..8669768 --- /dev/null +++ b/test_bandwidth_limit @@ -0,0 +1,39 @@ +#!/bin/bash + +# Doesn't actually work but gives a usage example + +if [ "x$1" == "xpv" ]; then + nc -l 15000 | pv > /dev/null + exit 0 +fi + +if [ "x$1" == "xcat" ]; then + cat /dev/zero | nc localhost 13300 + exit 0 +fi + +gnome-terminal --geometry 80x5 -e "./test_bandwidth_limit pv" +PID1=$! +echo PID1 = $PID1 +# --bandwidth-limit 1024 +./bandwidthmon --listen-port 13300 --remote-port 15000 --bandwidth-limit 1024 & +PID2=$! +sleep 1 +gnome-terminal --geometry 80x3 -e "./test_bandwidth_limit cat" +PID3=$! +echo PID3 = $PID3 + +function sigint { + echo "SIGINT caught" + if [ "x$PID1" != "x" ]; then + kill $PID1 + fi + kill $PID2 + kill $PID3 +} + +# SIGINT +trap sigint SIGINT + +wait +echo "all processes exited" |