Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions bin/runnel
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,22 @@ class Runnel
end

def start
puts "Starting #{conf[:name]}"
puts "AUTOSSH_PIDFILE=#{pid_file} autossh -M #{conf[:mport]} #{conf[:command]}"
ENV['AUTOSSH_PIDFILE'] = pid_file
`autossh -M #{conf[:mport]} #{conf[:command]}`
if running?
warn "It seems like #{conf[:name]} is already running:"
warn pp_description
else
puts "Starting #{conf[:name]}"
puts "AUTOSSH_PIDFILE=#{pid_file} autossh -M #{conf[:mport]} #{conf[:command]}"
ENV['AUTOSSH_PIDFILE'] = pid_file
`autossh -M #{conf[:mport]} #{conf[:command]}`
end
end

def kill
if running?
`kill #{pid}`
else
puts "Unable to find a running #{conf[:name]}"
warn "Unable to find a running #{conf[:name]}"
end
end

Expand Down Expand Up @@ -169,6 +174,14 @@ else
else
Runnel.start_all
end
when "restart"
if ARGV[1]
Runnel.kill(ARGV[1])
Runnel.start(ARGV[1])
else
Runnel.kill_all
Runnel.start_all
end
when "help"
puts HELP
else
Expand Down