Skip to content
Browse files

Handle TERM signal

  • Loading branch information...
1 parent 2feb141 commit 28d337f4302a90fc4cf7ebe0a10d25d299e3d7f4 @lmarburger lmarburger committed
Showing with 7 additions and 0 deletions.
  1. +7 −0 config/unicorn.rb
View
7 config/unicorn.rb
@@ -3,7 +3,14 @@
preload_app false
before_fork do |server, worker|
+ Signal.trap 'TERM' do
+ puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
+ Process.kill 'QUIT', Process.pid
+ end
end
after_fork do |server, worker|
+ Signal.trap 'TERM' do
+ puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT'
+ end
end

0 comments on commit 28d337f

Please sign in to comment.
Something went wrong with that request. Please try again.