Last active
October 12, 2016 03:13
-
-
Save tjmcewan/e3d3ac7a2d3ba1d3acfd04c88061b0a8 to your computer and use it in GitHub Desktop.
localtunnel restarter. all props to @michaelkeenan. slightly modified to be run as a executable & to remove ordinal numbers. original here: https://github.com/localtunnel/localtunnel/issues/81#issuecomment-218320442
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 | |
require 'optparse' | |
options = {:subdomain => 'defaultdomain', :port => 3000} | |
parser = OptionParser.new do|opts| | |
opts.banner = "Usage: localtunnel [options]" | |
opts.on('-s', '--subdomain subdomain', 'Subdomain') do |subdomain| | |
options[:subdomain] = subdomain; | |
end | |
opts.on('-p', '--port port', 'Port') do |port| | |
options[:port] = port; | |
end | |
opts.on('-h', '--help', 'Displays Help') do | |
puts opts | |
exit | |
end | |
end | |
parser.parse! | |
restart_count = 0 | |
while true | |
`lt --port #{options[:port]} --subdomain #{options[:subdomain]}` | |
restart_count += 1 | |
puts "times restarted: #{restart_count}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
put it in your path somewhere and run
chmod +x localtunnel