Advertisement
quark_zju

synergyc_safe.rb

Aug 9th, 2011
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.26 KB | None | 0 0
  1. #!/usr/bin/ruby
  2.  
  3. SERVER = ARGV[0] || 'www.example.com'
  4. PORT = '24800'
  5.  
  6. system "ssh -f -n -N -L localhost:#{PORT}:#{SERVER}:#{PORT} #{SERVER}" unless (`pidof ssh`.split.any? { |pid| File.read("/proc/#{pid}/cmdline").include? PORT })
  7.  
  8. exec 'synergyc localhost'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement