I had a very hard time to start JBoss as background process using Capistrano. At the I end I found the solution which is so simple. The important point is in you capfile don't execute the commmad with both nohup and ampersand (&). At first create start.sh file that will call run.sh to start the jboss.
The content of start.sh:
/opt/jboss-4.2.3.GA/bin/run.sh &
And in your capfile:
desc "start jboss server"
task :start_jboss do
set :use_sudo, true
set :user, prompt("User to run 'service jboss-frengine start' command: ")
run "nohup /opt/jboss-4.2.3.GA/bin/start.sh" # ONLY NOHUP IS USED, DON'T USE AMPERSAND HERE
end
Make sure the user has permission to write into nohup.out