#!/usr/bin/env ruby begin require 'throttle' rescue LoadError require 'rubygems' require 'throttle' end #throttle limit 500Kbps #throttle limit 600Kbps #throttle status #throttle reset def error(str) puts "Error: #{str}" end throttle = Throttle.new case ARGV[0] when "limit" if ARGV[1] throttle.limit(ARGV[1]) puts "Currently throttled at : #{throttle.status}" else error("Please provide a valid bit rate to limit.") end when "status" puts throttle.status when "reset" throttle.reset puts throttle.status else puts "Throttle Help!" puts "\nThrottling: " puts "throttle limit [bandwidth]" puts "throttle limit 500KBps" puts "throttle limit 12Mbps" puts "\nGet the current status:" puts "throttle status" puts "\nTurn off:" puts "throttle reset" end