1 2 Previous Next 20 Replies Latest reply on Nov 13, 2008 2:53 AM by dimitris Go to original post
      • 15. Re: run.sh to launch JBoss in background
        ips

        Yep, java has to be started in the background. Here's what I ended up with. It works correctly on RHEL and Cygwin.

        while [ 1 ]; do
         # Execute the JVM.
         "$JAVA" $JAVA_OPTS \
         -Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" \
         -classpath "$JBOSS_CLASSPATH" \
         org.jboss.Main "$@" &
         JBOSS_PID=$!
         echo "JBOSS_PID: $JBOSS_PID"
         # Trap common signals and relay them to the JBoss process.
         trap "echo Received SIGHUP. ; kill -HUP $JBOSS_PID" HUP
         trap "echo Received SIGINT. ; kill -TERM $JBOSS_PID" INT
         trap "echo Received SIGQUIT.; kill -QUIT $JBOSS_PID" QUIT
         trap "echo Received SIGPIPE.; kill -PIPE $JBOSS_PID" PIPE
         trap "echo Received SIGTERM.; kill -TERM $JBOSS_PID" TERM
         WAIT_STATUS=0
         while [ "$WAIT_STATUS" -ne 127 ]; do
         JBOSS_STATUS=$WAIT_STATUS
         wait $JBOSS_PID 2>/dev/null
         WAIT_STATUS=$?
         done
         if [ $JBOSS_STATUS -eq 10 ]; then
         echo Restarting JBossAS...
         else
         exit $JBOSS_STATUS
         fi
         # If restart doesn't work, see this if you're running JBossAS 4.0.4 or earlier:
         # http://jira.jboss.com/jira/browse/JBAS-2483
         # or this if you're running Red Hat 7.0:
         # http://developer.java.sun.com/developer/bugParade/bugs/4465334.html
        done
        


        I've attached a patch to http://jira.jboss.com/jira/browse/JBAS-3748. See my comment on that issue for an explanation of how I came up with the above.


        • 16. Re: run.sh to launch JBoss in background
          vpire

          So if I want to run this in background, what should execute in the console?

          ./run.sh -c default -Djboss.bind.address=123.123.1.1

          • 17. Re: run.sh to launch JBoss in background
            dimitris

            export LAUNCH_JBOSS_IN_BACKGROUND=1
            run.sh whatever-flags-you-want &

            • 18. Re: run.sh to launch JBoss in background
              vpire

              Thanks dimitris, I will give it a try.

              • 19. Re: run.sh to launch JBoss in background
                ips

                I've added a new section on the run.sh JBoss Wiki page documenting the background launch option.

                http://www.jboss.org/community/docs/DOC-12306

                • 20. Re: run.sh to launch JBoss in background
                  dimitris

                  @ips, very good, thanks.

                  1 2 Previous Next