require 'net/ssh/gateway' require 'net/http' include Process $gateway = Net::SSH::Gateway.new('access.grid5000.fr', 'msimonin') ports = [] def close() $gateway.shutdown! end # Trap ^C Signal.trap("INT") { close() exit } # Trap ^C Signal.trap("TERM") { close() exit } remote_host = 'parapide-9.rennes.grid5000.fr' remote_ports = [5601, 3000] remote_ports.each do |remote_port| port = $gateway.open(remote_host, remote_port) puts "localhost:#{port} forwards to #{remote_host}:#{remote_port}" end wait