문제

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.

도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top