1 Reply Latest reply on Sep 9, 2013 2:46 PM by prieser

    Easy question: ¿how to run JBOSS 4.2 as a Daemon?

    prieser Newbie

      Hi dear jboss community,

       

      I am trying to run Jboss 4.2 in a Red Hat server. I learned that I need to create a script on init.d, but I have troubles with the script. I know that there is several post related, but I followed some of them and doesnt works.

       

      Can you can provide me some simple script implementation?

       

      Next I will copy some information that could be important:

       

      Jboss version: 4.2

      Jboss home: /usr/local/jboss

       

      Thanks a lot!

        • 1. Re: Easy question: ¿how to run JBOSS 4.2 as a Daemon?
          prieser Newbie

          Currently mi script is this:

           

          #! /bin/sh

           

          start(){

                  echo "Starting jboss.."

                  sudo -u root /usr/local/jboss/bin/run.sh

                  echo "jboss started"

          }

           

          stop(){

                  echo "Stopping jboss.."

                  sudo -u root /usr/local/jboss/bin/shutdown.sh -S &

                  echo "jboss stoped"

          }

           

          restart(){

                  stop

          # give stuff some time to stop before we restart

                  sleep 60

          # protect against any services that can't stop before we restart (warning this kills all Java instances running as 'jboss' user)

                  sudo -u root killall java

                  start

          }

           

          case "$1" in

            start)

                  start

                  ;;

            stop)

                  stop

                  ;;

            restart)

                  restart

                  ;;

            *)

                  echo "Usage: jboss {start|stop|restart}"

                  exit 1

          esac

           

          exit 0

           

          when I execute sudo -u root /usr/local/jboss/bin/run.sh works fine, but when I execute service jboss start it is not.