jboss autostart script for /etc/init.d

The init script I use which allows proper start and stop of JBoss on Ubuntu systems

#! /bin/sh

echo "JBoss $1"

export JAVA_HOME="/usr/lib/jvm/java-1.5.0-sun"

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/equandajboss-4.2.2/bin
NAME=jboss
DESC="JBoss AS"

JBOSSOPTS="--host 0.0.0.0"
USER="jboss"

test -x $DAEMON || exit 0

set -e

case "$1" in
  start)
        echo -n "Starting $DESC: "
        start-stop-daemon -u $USER --start --background --quiet --exec $DAEMON/run.sh -- $JBOSSOPTS
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping $DESC: "
        $DAEMON/shutdown.sh -S
        echo "$NAME."
        ;;
  restart|force-reload)
        echo -n "Restarting $DESC: "
        $DAEMON/shutdown.sh -S
        sleep 1
        start-stop-daemon -u $USER --start --background --quiet --exec $DAEMON/run.sh -- $JBOSSOPTS
        echo "$NAME."
        ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

exit 0

2 Comments

  1. Marco Rojas says:

    You are my hero…I have tried everything I can think of and this script was the only one that worked on Ubuntu 8.04.

    Thank you very much.

  2. Tambakoly says:

    thanks a lot for your script …
    It works for me angeliously …

Leave a Reply

Your email address will not be published. Required fields are marked *

question razz sad evil exclaim smile redface biggrin surprised eek confused cool lol mad twisted rolleyes wink idea arrow neutral cry mrgreen

*