Hiya!
> tim that is a neat little script to keep jBoss running in production I am
> sure people will find it useful,
>
> could you give it in a simple web page "Solaris autoboot how to". Nothing
> fancy just this mail in web format
Yeah, no worries, I hope it helps someone...
NOTE: Some of the lines in the <pre> section could line-wrap and make
themselves invalid (especially the CLASSPATH settings) I guess it depends on
your mailer ;O)
Good luck with the future development,
Thanks again,
Tim.
==================================================
<html>
<head>
<title>Solaris autoboot how-to</title>
</head>
<body>
<H2>Autobooting jBoss on Solaris</H2>
<br>
Hello, here is my script to get jBoss and Tomcat to autoboot (on Solaris
8,but it should work on earlier versions, and maybe other Unix flavours) --
I hope it is accurate and helpful to at least someone.
<br><br>
It will also reboot jBoss should it ever go down.
<br><br>
First, copy this script, and place it as a file called "startupSH" (without
the quotes) inside the bin directory of the jBoss installation
<br><br>
<ul><ul><pre>
#! /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
</pre></ul></ul>
<br>
Then, edit <tt>/etc/inittab</tt>, and add the following line:
<br>
<tt>
<ul><ul>jb:234:respawn:/opt/jboss/bin/startupSH</ul></ul>
</tt>
You should then be able to reboot the machine, and jBoss should start
automatically <br><br>
<h3>Notes:</h3>
<ul>
<li>You must make sure that "jb" is unique in <tt>/etc/inittab</tt>, as
otherwise this might not work...
<li>The last part of the <tt>/etc/inittab</tt> line should point the the
actual location of <tt>startupSH</tt>
<li>If you are connecting to an Oracle database, you may want to
put a "<tt>sleep 300</tt>" (without the quotes) call near the top of this
script (before the while loop) to give the Oracle database 5 minutes to come
up before jBoss tries to connect
</ul>
<br>
I hope this works for others, and jBoss continues to grow. Good luck, and
thanks to everyone!!
<br><br>
Tim Yates -- Developer, <a href="www.teamnetsol.com">Team Netsol</a>
16/11/2000<br>
<a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
<br><br>
<h3>Disclaimer:</H3>
<ul>
<li>
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 helpful on some topics ;-)
<li>
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 ;-)
</ul>
</body>
</html>
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]