Skip to content

Instantly share code, notes, and snippets.

@tjmcewan
Last active Oct 12, 2016
Embed
What would you like to do?
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
#!/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
@tjmcewan

This comment has been minimized.

Copy link
Owner Author

@tjmcewan tjmcewan commented Oct 12, 2016

put it in your path somewhere and run chmod +x localtunnel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment