5 Replies Latest reply on Jan 27, 2010 11:13 AM by peterj

    JBOSS does not start up on boot

      Hello all,

       

      I'm trying to get JBoss to start up on boot.  I am running Debian 2.1

       

      I'm using this website: http://www.debian-administration.org/article/Making_scripts_run_at_boot_time_with_Debian

       

      This is the script I'm using:

       

      #! /bin/sh
      #  /etc/init.d/jboss: Start and stop JBoss AS
      ECHO=/bin/echo
      TEST=/usr/bin/test
      JBOSS_START_SCRIPT=/usr/local/jboss-4.0.3SP1/bin/run.sh
      JBOSS_STOP_SCRIPT=/usr/local/jboss-4.0.3SP1/bin/shutdown.sh

      $TEST –x $JBOSS_START_SCRIPT || exit 0
      $TEST –x $JBOSS_STOP_SCRIPT || exit 0

      start() {
            $ECHO –n "Starting JBoss"
            su – jboss –c "$JBOSS_START_SCRIPT > /dev/null 2> /dev/null &"
            $ECHO "."
      }

      stop() {
            $ECHO –n "Stopping JBoss"
            su – jboss – c "$JBOSS_STOP_SCRIPT –S > /dev/null &"
            $ECHO "."
      }

      case "$1" in
            start)
                  start
                  ;;
            stop)
                  stop
                  ;;
            restart)
                  stop
                  sleep 30
                  start
                  ;;
            *)
                  $ECHO "Usage: jboss {start|stop|restart}"
                  exit 1
      esac

      exit 0

       

      However, when I follow the instructions on the website and do:

       

      ./jboss

       

      I get an error : /usr/bin/test: extra argument `/opt/jboss-4.2.3.GA/bin/run.sh

       

      I get the same thing for the shutdown.sh part.

       

      When I add arguments to both of those lines, it still complains.  Any ideas what I may be doing wrong?

       

      I know I'm really close, probably just a minor tweak.

       

      All / any input from you all will definitely help! I will give points to right answers.

        • 1. Re: JBOSS does not start up on boot
          erasmomarciano

          I think  that you forgot to specify the JBoss instance

           

          example

           

          ./run.sh -c all -b 0.0.0.0

          • 2. Re: JBOSS does not start up on boot
            peterj

            Looking at the 'test' commands man page, it would appear that you need to place the expression within paranthesis:

             

            $TEST (-x filename)

             

            You might even need quotes:

             

            $TEST "(-x filename)"

             

            I don't have a Linux machine handy just now or I would give you a more definitive answer.

             

            Anyway, the best way of debugging a script is to always enter each command in by hand, especially commands that fail.

            1 of 1 people found this helpful
            • 3. Re: JBOSS does not start up on boot
              peterj

              OK, I have my Linux system. I tried a simple script based on what you had and the syntax:

               

              $TEST -x $FILENAME || exit 0

               

              worked just fine. I am using Ubuntu 9.04.

               

              Perhaps try running:

               

              test --help

               

              Maybe 'test' is really not 'test'!

              1 of 1 people found this helpful
              • 4. Re: JBOSS does not start up on boot

                Peter,

                 

                You answers were definitly helpful.  It appears the problem I was having was I needed to run dos2unix on this script.  I'm not sure why, but I can get the script to run on boot now.

                 

                Thanks for your help.

                • 5. Re: JBOSS does not start up on boot
                  peterj

                  "I needed to run dos2unix on this script"

                   

                  Ah yes, Linux scripts will not run if they are in the DOS text format (lines ending with CR-LF), they think that the CR is part of the command which causes confusion.