[jboss-dev-forums] [Other JBoss Development Design] - Re: run.sh to launch JBoss in background

dimitris@jboss.org do-not-reply at jboss.com
Mon Oct 9 11:17:41 EDT 2006


Ideally we just want to say, forward received traps to any child process, like what the shell does when executed in interactive mode.

When using 'trap' the problem is you don't have the PID of the executing java process, unless you start java in the background.

The following seems to work

  |    # Execute the JVM in the background
  |    "$JAVA" $JAVA_OPTS \
  |       -Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" \
  |       -classpath "$JBOSS_CLASSPATH" \
  |       org.jboss.Main "$@" &
  |    JBOSS_PID=$!
  |    trap "kill -HUP $JBOSS_PID" SIGHUP
  |    trap "kill -TERM $JBOSS_PID" SIGTERM
  |    wait
  | 

i.e. using this you can run.sh in the background, then killing run.sh kills the JVM too, but I'd prefer a solution where we don't have to start the JVM in the background and wait.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976988#3976988

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976988



More information about the jboss-dev-forums mailing list