When starting JBossAS, we have the possibility to start it as a background process. To do that, we should set the environment variable "LAUNCH_JBOSS_IN_BACKGROUND" to any value. The run.sh script will still "block" the shell, as it waits for the JBoss process to finish and dispatch any received signals (including ctrl+c) to the JBoss process. So, I don't see any side effect (or different behaviour than without the env var set), but Mladen can comment better on this.
So, in case one needs to create a PID file for JBossAS, all is needed is to export two environment variables before starting JBossAS via run.sh: