launching background process in capistrano task launching background process in capistrano task linux linux

launching background process in capistrano task


Try forking the process as explained here: Spawn a background process in Ruby

You should be able to do something like this:

job1 = fork do  run "svscanboot"endProcess.detach(job1)

As well, checkout this: Starting background tasks with Capistrano


My simple solution would be make svscanboot.sh file at remote server with whatever code you want to run. In your case

svscanboot >/tmp/svscanboot.log 2>&1

In cap rake task add this

run "sh +x somefile.sh &"

this works well for me.


I think nohup just launches the process in background, so you don't need to explicitly set the last &.

Did you try

run "nohup svscanboot >/tmp/svscanboot.log 2>&1"

(without the ending & to send it to the background).

That should work and remain running when your current capistrano session is closed.