The following works for Slackware 9.1. I usually have JBoss running automatically when I boot my laptop.
You will need this in the run.sh script for JBoss to capture the PID.
echo $$ > /tmp/jboss.pid
The script is intended to run as root and then the script runs the JBoss process as the apache user. The less privileged account means that run.sh cannot write the PID to /var/run/jboss.pid directly, hence the messing around with the transfer in the rc.d script. The most important point is to send the run script into the background and reroute all console output to a designated log file.
Thanks man, I'll put this to good use right away.
Works like a champ! It still binds to my tty if I start or restart it manually, but that doesn't matter as it is not listed as a job attached my uid. Therefore it doesn't exit when I logout.