Reputation: 858
I know this question has been asked a lot, but I cannot manage to get it right. I have already looked at :
I am using capistrano to deploy a server in scala. My task looks like this :
desc "Start server"
task :start do
run "cd #{deploy_to} && ./sbt compile start-script"
run "cd #{deploy_to} && export PORT=#{server_port} && export ENV=#{env} && nohup target/start > /dev/null 2>&1 &"
end
start-script is an sbt plugin that creates a script in target/start. When I run the task, the output is :
* executing "cd /home/ubuntu/* && export PORT=* && export ENV=integration && nohup target/start > /dev/null 2>&1 &"
servers: ["54.217.224.197"]
[54.217.224.197] executing command
command finished in 1015ms
but my server is not started... When omitting the "&" at the end of the command, the server is started but the capistrano script is blocked.
* executing "cd /home/ubuntu/* && export PORT=* && export ENV=integration && nohup target/start > /dev/null 2>&1"
servers: ["54.217.224.197"]
[54.217.224.197] executing command
Thanks in advance for your answers.
Upvotes: 1
Views: 1021
Reputation: 858
I found a solution, just add pty: false at the end
run "cd #{deploy_to} && export PORT=#{server_port} && export ENV=#{env} && nohup target/start > /dev/null 2>&1 &" pty: false
Upvotes: 2