Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
fix(appserver): Wait up to 10 sec for graceful shutdown
Browse files Browse the repository at this point in the history
Fixes #127
  • Loading branch information
ajgon committed Nov 28, 2017
1 parent fb4f557 commit a066a6d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions templates/default/appserver.service.erb
Expand Up @@ -46,12 +46,19 @@ def start_<%= @name %>
end
def stop_<%= @name %>
if <%= @name %>_running?
if run_and_ignore_exitcode_and_print_command "kill -QUIT `cat #{PID_PATH}`"
`rm #{PID_PATH}`
end
else
unless <%= @name %>_running?
puts "You can't stop <%= @name %>, because it's not running"
return
end
retries = 10
loop do
break if !<%= @name %>_running? || retries <= 0

run_and_ignore_exitcode_and_print_command "kill -QUIT `cat #{PID_PATH}`"
sleep 1
retries -= 1
end
end

Expand Down

0 comments on commit a066a6d

Please sign in to comment.