Sha256: 4e2333a048a266a7ead17bb88b511cfd9bb09a2541750170292e69adfd5608f8

Contents?: true

Size: 824 Bytes

Versions: 2

Compression:

Stored size: 824 Bytes

Contents

#!/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  

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
throttle-0.0.2 bin/throttle
throttle-0.0.1 bin/throttle