1 Reply Latest reply on Mar 11, 2005 2:12 PM by Alejandro Alberini

    run jboss as a service for 'all' server configuration on Lin

    namitajain Newbie

      Hi All,
      I am able to run jboss with tomcat as service on Linux, but only in 'default' mode by using the scripts given below. Can anyone let me know what changes should be done to start jboss in 'all' config. ( like done in $JBOSS_HOME/bin/run.sh - c all )

      *************************************************************************
      I have go.sh in $JBOSS_HOME/bin as follows:
      *************************************************************************
      #!/bin/sh
      #
      # Shell script to start and stop integrated JBoss/Tomcat

      # change this according to your own situation
      export JAVA_HOME=/usr/java/j2sdk1.4.2_05
      export JBOSS_HOME=/usr/local/jboss-3.2.5

      JAVACMD=$JAVA_HOME/bin/java

      # Minimal jar file to get JBoss started.
      CLASSPATH=$CLASSPATH:$JBOSS_HOME/bin/run.jar

      # Add the tools.jar file so that Tomcat can find the Java compiler.
      CLASSPATH="$CLASSPATH:$JAVA_HOME/lib/tools.jar"

      if [ "$1" = "start" ] ; then
      shift
      $JAVACMD $JBOSS_OPTS -classpath $CLASSPATH org.jboss.Main > /dev/null 2>&1 &
      echo $! > /var/run/jboss.pid

      elif [ "$1" = "stop" ] ; then
      shift
      kill -15 `cat /var/run/jboss.pid`
      rm -rf /var/run/jboss.pid

      elif [ "$1" = "run" ] ; then
      shift
      $JAVACMD $JBOSS_OPTS -classpath $CLASSPATH org.jboss.Main "$@"

      else
      echo "Usage:"
      echo "jboss (start|run|stop)"
      echo " start - start jboss in the background"
      echo " run - start jboss in the foreground"
      echo " stop - stop jboss"
      exit 0
      fi

      ************************************************************************
      I have jboss.sh in /etc/init.d as:
      ************************************************************************
      #!/bin/sh
      #
      #startup script for JBOSS, the J2EE EJB Server
      #
      # chkconfig: 2345 95 15
      # description: JBoss is an EJB Server
      # processname: jboss
      # pidfile: /var/run/jboss.pid
      # config: /usr/local/jboss/conf/default/jboss.conf
      # logfile: /usr/local/jboss/log/server.log
      #

      # Source function library.
      . /etc/rc.d/init.d/functions

      # change this according to your own situation
      export JAVA_HOME=/usr/java/j2sdk1.4.2_05
      export JBOSS_HOME=/usr/local/jboss-3.2.5
      export PATH=$PATH:$JBOSS_HOME/bin:$JAVA_HOME/bin:$JAVA_HOME/jre/bin

      RETVAL=0

      # See how we were called.
      case "$1" in
      start)
      cd $JBOSS_HOME/bin
      echo -n "Starting jboss daemon: "
      daemon $JBOSS_HOME/bin/go.sh start
      RETVAL=$?
      echo
      [ $RETVAL -eq 0 ] && touch /var/lock/subsys/jboss
      ;;
      stop)
      echo -n "Stopping jboss daemon: "
      killproc jboss
      RETVAL=$?
      echo
      [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/jboss
      ;;
      restart)
      echo -n "Restarting jboss daemon: "
      $0 stop
      sleep 2
      $0 start
      ;;
      esac

      I have also made soft links to /etc/rc3.d and /etc/rc5.d to start n stop the jboss server on system restart.

      Any help will be appreciated:
      Thanks:
      N.J