Answer the question
In order to leave comments, you need to log in
What is the correct way to restart Unicorn?
New to rails, please help. I start Unicorn with the command
unicorn_rails -c config/unicorn.rb -D -E development
Answer the question
In order to leave comments, you need to log in
You can send a signal:
In my Capistrano I use it like this:
namespace :unicorn do
pid_path = "#{release_path}/tmp/pids"
unicorn_pid = "#{pid_path}/unicorn.pid"
def run_unicorn
execute "#{fetch(:bundle_binstubs)}/unicorn", "-c #{release_path}/config/unicorn.rb -D -E #{fetch(:stage)}"
end
desc 'Start unicorn'
task :start do
on roles(:app) do
run_unicorn
end
end
desc 'Stop unicorn'
task :stop do
on roles(:app) do
if test "[ -f #{unicorn_pid} ]"
execute :kill, "-QUIT `cat #{unicorn_pid}`"
end
end
end
desc 'Force stop unicorn (kill -9)'
task :force_stop do
on roles(:app) do
if test "[ -f #{unicorn_pid} ]"
execute :kill, "-9 `cat #{unicorn_pid}`"
execute :rm, unicorn_pid
end
end
end
desc 'Restart unicorn'
task :restart do
on roles(:app) do
if test "[ -f #{unicorn_pid} ]"
execute :kill, "-USR2 `cat #{unicorn_pid}`"
else
run_unicorn
end
end
end
end
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question