Created
July 6, 2009 16:19
-
-
Save jonuts/141518 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
abort("usage: #{__FILE__} START_PORT END_PORT") unless ARGV.size == 2 | |
START_PORT = ARGV.shift.to_i | |
END_PORT = ARGV.shift.to_i | |
loop do | |
used_ports = [] | |
START_PORT.upto(END_PORT).each do |port| | |
scan = `lsof -i :#{port}`.chomp | |
used_ports << port unless scan.empty? | |
end | |
break if used_ports.empty? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment