2 Replies Latest reply on Dec 7, 2006 8:18 AM by Lennart Petersson

    JBoss Web running on OSX!

    Leaked Geo Newbie

      Hey all,
      I just thought I'd post some news from the mac world... I just discovered JBoss Web and I must say the idea is great! No more fiddling around with Apache or IIS and Tomcat and JBoss AS! Finally, a single solution to unify them all...

      Anyway, I was disappointed to discover only HP UNIX, SuSE Linux, RedHat Linux and Windows scripts in the bin directory (I've used JBoss AS on my mac for a while)... Good news is: I finally got the thing purring by modifying the SuSE script slightly!

      For all the other mac-heads out there who wish to play with JBoss Web on their machines, just create a log directory under the JBoss Web directory and use the following script to start, stop and restart JBoss Web from the Terminal (replace the JBOSS_HOME variable with your own of course!, the Java one should be the same):

      # JBoss Control Script
      # To use this script
      # run it as root - it will switch to the specified user
      # It loses all console output - use the log.
      # Here is a little (and extremely primitive)
      # startup/shutdown script for SuSE systems. It assumes
      # that JBoss lives in /usr/local/jboss, it's run by user
      # 'jboss' and JDK binaries are in /usr/local/jdk/bin. All
      # this can be changed in the script itself.
      # Either amend this script for your requirements
      # or just ensure that the following variables are set correctly
      # before calling the script.
      # Provides: jboss
      # Default-Start: 3 5
      # Default-Stop: 0 1 2 6
      # Description: Start the JBoss application server.
      ### END INIT INFO

      #define where jboss is - this is the directory containing directories log, bin, conf etc

      #make java is on your path

      #define the classpath for the shutdown class

      #define the script to use to start jboss
      JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh -c default"}

      # Shell functions sourced from /etc/rc.status:
      # rc_check check and set local and overall rc status
      # rc_status check and set local and overall rc status
      # rc_status -v ditto but be verbose in local rc status
      # rc_status -v -r ditto and clear the local rc status
      # rc_failed set local and overall rc status to failed
      # rc_reset clear local rc status (overall remains)
      # rc_exit exit appropriate to overall rc status
      #. /etc/rc.status

      # First reset status of this service

      # Return values acc. to LSB for all commands but status:
      # 0 - success
      # 1 - misc error
      # 2 - invalid or excess args
      # 3 - unimplemented feature (e.g. reload)
      # 4 - insufficient privilege
      # 5 - program not installed
      # 6 - program not configured
      # Note that starting an already running service, stopping
      # or restarting a not-running service as well as the restart
      # with force-reload (in case signalling is not supported) are
      # considered a success.

      if [ -n "$JBOSS_CONSOLE" -a ! -d "$JBOSS_CONSOLE" ]; then
      # ensure the file exists
      touch $JBOSS_CONSOLE

      if [ -n "$JBOSS_CONSOLE" -a ! -f "$JBOSS_CONSOLE" ]; then
      echo "WARNING: location for saving console log invalid: $JBOSS_CONSOLE"
      echo "WARNING: ignoring it and using /dev/null"

      #define what will be done with the console log

      #define the user under which jboss will run, or use RUNASIS to run as the current user

      CMD_STOP="java -classpath $JBOSSCP org.jboss.Shutdown --shutdown"

      if [ "$JBOSSUS" = "RUNASIS" ]; then
      SUBIT="su - $JBOSSUS -c "

      if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then
      export PATH=$PATH:$JAVAPTH

      if [ ! -d "$JBOSS_HOME" ]; then
      echo JBOSS_HOME does not exist as a valid directory : $JBOSS_HOME
      exit 1

      case "$1" in
      echo -n "Starting JBoss application server: "
      cd $JBOSS_HOME/bin
      if [ -z "$SUBIT" ]; then
      eval $CMD_START >${JBOSS_CONSOLE} 2>&1 &
      $SUBIT "$CMD_START >${JBOSS_CONSOLE} 2>&1 &"

      # Remember status and be verbose
      #rc_status -v
      echo -n "Shutting down JBoss application server: "
      if [ -z "$SUBIT" ]; then
      $SUBIT "$CMD_STOP"

      # Remember status and be verbose
      #rc_status -v
      $0 stop
      $0 start

      # Remember status and be quiet
      echo "usage: $0 (start|stop|restart|help)"