Capistrano recipe to restart standalone passenger server

You want to be able to use different ruby versions with passenger and by following the article here, you have set up your server to server the second version with a standalone passenger version. If you do that you cannot use the ‘touch tmp/restart.txt’ command to restart the standalone passenger server.

What you would need to do in your config/deploy.rb file, and assuming that your standalone passenger runs on a port (4000) different from the default (3000), is to replace the following:

run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"


run "cd #{release_path} && passenger stop -p 4000 && passenger start #{current_path} -a -p 4000 -e production -d --pid-file #{current_path}/tmp/pids/ --log-file #{current_path}/log/passenger.4000.log"