Можно послать сигнал:
kill -USR2 `cat tmp/pids/unicorn.pid`
У себя в Capistrano использую это вот так:
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