Hello, here is my script to get jBoss and Tomcat to autoboot (on Solaris 8,
but earlier versions should work too -- and maybe other Unix flavours) -- I
hope it is accurate and helpful to at least someone...(and not redundant)

(you'll have to excuse my lack of confidence, this is my first post to this
mailing list)

first, copy this script, and place it as a file called "startupSH" (without
the quotes) inside the bin directory of the jBoss installation

START OF startupSH=====================================================

#! /bin/sh -f
# Originally taken from EnvyMud v2.2
# Written by Furey.
# With additions from Tony.
# With changes from Kahn.
# Ported to 'sh' by Loki for those who don't have 'csh'.
# Thanks to Alan and Grodyn for thier help on the redirecting stuff - Loki
#---------------------------------------------------------------------------
# Converted (ripped apart) to run jBoss by _tim_ 2000
# Free to distribute, change, hack, rm, etc...

# Installation specific variables...  These will need changing...
#---------------------------------------------------------------------------
TOMCAT_HOME=/opt/tomcat
JBOSS_HOME=/opt/jboss
JAVA_HOME=/usr/java
CLASSPATH=
#---------------------------------------------------------------------------

# Set the working directory
#---------------------------------------------------------------------------
cd ${JBOSS_HOME}/bin
#---------------------------------------------------------------------------

# NB: A lot of this is lifted straight from "run.sh" in the jBoss
installation

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


if [ "${TOMCAT_HOME}X" != "X" ] ; then
    if [ -x $TOMCAT_HOME ] ; then
        echo "Adding jar files in ${TOMCAT_HOME}/lib to CLASSPATH"
        CLASSPATH="$CLASSPATH:${TOMCAT_HOME}/lib"
        CLASSPATH="$CLASSPATH:${TOMCAT_HOME}/lib/servlet.jar"
        CLASSPATH="$CLASSPATH:${TOMCAT_HOME}/lib/webserver.jar"
        CLASSPATH="$CLASSPATH:${TOMCAT_HOME}/lib/xml.jar"
        CLASSPATH="$CLASSPATH:${TOMCAT_HOME}/lib/jaxp.jar"
        CLASSPATH="$CLASSPATH:${TOMCAT_HOME}/lib/parser.jar"
        CLASSPATH="$CLASSPATH:${TOMCAT_HOME}/lib/jasper.jar"

        # Add the tools.jar file so that Tomcat can find the Java compiler.
        CLASSPATH="$CLASSPATH:$JAVA_HOME/lib/tools.jar"
    else
        echo "TOMCAT_HOME is set, but is an invalid directory"
    fi
fi

#if [ "${SPYDERMQ_HOME}X" != "X" ] ; then
#    if [ -x $SPYDERMQ_HOME ] ; then
#        echo "Adding jar files in ${SPYDERMQ_HOME}/lib to CLASSPATH"
#        CLASSPATH="$CLASSPATH:${SPYDERMQ_HOME}/lib/spydermq.jar"
#        CLASSPATH="$CLASSPATH:${SPYDERMQ_HOME}/lib/jms.jar"
#        CLASSPATH="$CLASSPATH:${SPYDERMQ_HOME}/lib/jnpserver.jar"
#    else
#        echo "SPYDERMQ_HOME is set, but is an invalid directory"
#    fi
#fi

# Add all login modules for JAAS-based security
# and all libraries that are used by them here
CLASSPATH="$CLASSPATH:${JBOSS_HOME}/lib/jdbc2_0-stdext.jar:${JBOSS_HOME}/lib
/jboss-jaas.jar"

echo $CLASSPATH

while [ 1 ]
do
    # Run jBoss.
    # If it crashes, or goes down, sleep 10 seconds, then reboot it...
    java -server -classpath $CLASSPATH -Dtomcat.home=$TOMCAT_HOME
org.jboss.Main $@
    sleep 10
done

END OF startupSH=====================================================

Then, edit /etc/inittab, and add the following line:

jb:234:respawn:/opt/jboss/bin/startupSH

You must make sure that "jb" is unique in the table, as otherwise this might
not work...

You should then be able to reboot the machine, and jBoss should start
automatically

I hope this works for others, and I hope jBoss continues to grow

Good luck, and thanks to everyone!!

Tim.

Disclaimer:
    -- I am in so way a *nix "guru", nor have I had any training with
scripts, and system level *nix stuff.  There are bound to be errors/flaws in
my script, and I welcome constructive help pointing out where thesre
errors/flaws are...  The man pages are less than helpfull on some topics ;-)
    -- Yes, I took the skeleton of the script from a Multi User Dungeon, but
I have found them (over time) to be a wonderful source of secure well
documented code and script snippets.  Anything that has had thousands of
coders pouring over it, is bound to be better that anything I could write on
a whim ;-)




--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to