I'am trying to create the Unicorn restart task with Capistrano 3:
Firstly, I set *unicorn_pid* variable:
set :unicorn_pid, "#{shared_path}/tmp/pids/unicorn.pid"
Then I pass it to the restart task:
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :kill, "-USR2 `cat #{fetch(:unicorn_pid)}`" if test "[ -f #{fetch(:unicorn_pid)} ]"
within release_path do
execute :bundle, "exec unicorn -D -c config/unicorn.rb -E #{fetch(:stage)}"
end
end
end
but when i run cap production deploy:restart
i see:
DEBUG [f4159760] Running /usr/bin/env [ -f /var/www/shared/tmp/pids/unicorn.pid ] on dev.project.net
DEBUG [f4159760] Command: [ -f /var/www/shared/tmp/pids/unicorn.pid ]
So, instead /home/user/project/shared/
path, #{shared_path} transform to /var/www/shared/
But when I specify this path directly in the task, without unicorn_pid variable I see in the output:
INFO [567856e3] Running /usr/bin/env kill -USR2 `cat /home/user/project/shared/tmp/pids/unicorn.pid` on dev.educapsule.net
DEBUG [567856e3] Command: /usr/bin/env kill -USR2 `cat /home/user/project/shared/tmp/pids/unicorn.pid`
Why the path is changed to /var/www/shared/
when I pass it in "custom" variable?
Thanks.