Since I'm running debian, the included init script with JBoss 3.0.x
didn't work on my (woody) box.  Didn't have time to figure out why,
excatly, so I just wrote my own that works a little differently.

It's pretty straightforward.  Basic init features like start, stop, and
status are supported (not restart because that might take different
amounts of time on different machines).  Defaults can be edited at the
start of the script.  Several options are provided, so check out the
script to find out what...

Hope this helps someone! :-)

Jon Brisbin




#!/bin/sh
##
#  Generic init script to start the JBoss server
#
SERVER="JBoss"
VERSION="3.0.2"

##
#  Defaults
#
JDKDIR=/opt/java/jdk14
JBOSSDIR=/opt/java/jboss-3.0.2
JBOSSUSER=jboss
JBOSSSTART=bin/run.sh
JBOSSEND=bin/shutdown.sh

##
#  Set JBoss root dir to something from the environment, or put in a
meaningful
#    default.
#
if [ "$JBOSS_HOME" != "" ]; then
        JBOSS_HOME=$JBOSS_HOME
else
        JBOSS_HOME=$JBOSSDIR
fi

##
#  Set the JDK root dir
#
if [ "$JAVA_HOME" != "" ]; then
        JAVA_HOME=$JAVA_HOME
else
        JAVA_HOME=$JDKDIR
fi

##
#  Set the user to run under, or default to 'jboss'
#
if [ "$JBOSS_USER" != "" ]; then
        JBOSS_USER=$JBOSS_USER
else
        JBOSS_USER=$JBOSSUSER
fi

##
#  If we specify a file to pipe console output to, make sure it exists
#
if [ "$JBOSS_CONSOLE" != "" ]; then
        JBOSS_CONSOLE=$JBOSS_CONSOLE
        touch $JBOSS_CONSOLE
else
        JBOSS_CONSOLE=/dev/null
fi

##
#  If we specify a configuration to run (under the 'server/' directory)
#    then use that, otherwise default to 'all'
#
if [ "$JBOSS_CONFIGURATION" != "" ]; then
        JBOSS_CONFIGURATION=$JBOSS_CONFIGURATION
else
        JBOSS_CONFIGURATION=all
fi

##
#  If we use something other than 'run.sh' we need to know about it
#
if [ "$JBOSS_START" != "" ]; then
        JBOSS_START=$JBOSS_START
else
        JBOSS_START=$JBOSSSTART
fi

##
#  If we use something other than 'shutdown.sh' we need to know about
it
#
if [ "$JBOSS_END" != "" ]; then
        JBOSS_END=$JBOSS_END
else
        JBOSS_END=$JBOSSEND
fi

##
#  Init options
#
case $1 in

        start)
                echo "Starting $SERVER $VERSION (in the background) using JDK in
$JAVA_HOME."
                su -c "cd $JBOSS_HOME && $JBOSS_START >$JBOSS_CONSOLE 2>&1 &"
$JBOSS_USER
        ;;

        stop)
                echo "Stopping $SERVER $VERSION (in the background)."
                su -c "cd $JBOSS_HOME && $JBOSS_END >$JBOSS_CONSOLE 2>&1 &"
$JBOSS_USER
        ;;

        restart)
                echo "Restarting the JBoss server is not currently supported by this
init script."
                echo "Please issue a 'start' and then 'stop' instead."
                exit 1
        ;;

        status)
                if [ -n "`ps ax|egrep org.jboss.Main|egrep java`" ]; then
                        echo "$SERVER $VERSION is running."
                else
                        echo "$SERVER $VERSION is NOT running."
                fi
        ;;

        *)
                echo "Usage: jboss {start|stop|restart|status}"
                exit 1
        ;;

esac

exit 0


__________________________________________________
Yahoo! - We Remember
9-11: A tribute to the more than 3,000 lives lost
http://dir.remember.yahoo.com/tribute


-------------------------------------------------------
In remembrance
www.osdn.com/911/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to