Monday, March 24, 2014

Port check script by ruby

172:rp young$ cat port_check.rb 
#!/usr/bin/env ruby

require 'rubygems'
require 'net/ping'

if Net::Ping::TCP.new(ARGV[0],ARGV[1]).ping
   puts "Pong!"
else
   puts "No response"
end
172:rp young$ ruby port_check.rb www.google.com 80
Pong!

172:rp young$ 

No comments:

Post a Comment