Ok, I've installed JBoss 4 on Slackware 10.0 and can start it as user "jboss". Now I'm working on modifying the canned jboss_init_suse.sh script that comes with JBoss to start it at boot time. I'm calling it /etc/rc.d/rc.jboss:
Code:
#!/bin/sh
#
# JBoss Control Script
#
# To use this script
# run it as root - it will switch to the specified user
# It loses all console output - use the log.
#
#define where jboss is - this is the directory containing directories log, bin, conf etc
JBOSS_HOME=${JBOSS_HOME:-"/usr/local/jboss"}
#make java is on your path
JAVAPTH=${JAVAPTH:-"/usr/lib/java/bin"}
#define the classpath for the shutdown class
JBOSSCP=${JBOSSCP:-"$JBOSS_HOME/bin/shutdown.jar:$JBOSS_HOME/client/jnet.jar"}
#define the script to use to start jboss
JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh -c default"}
#define what will be done with the console log
JBOSS_CONSOLE=${JBOSS_CONSOLE:-"/usr/local/jboss/server/default/log/jboss.log"}
#define the user under which jboss will run, or use RUNASIS to run as the current user
JBOSSUS=${JBOSSUS:-"jboss"}
CMD_START="cd $JBOSS_HOME/bin; $JBOSSSH"
CMD_STOP="java -classpath $JBOSSCP org.jboss.Shutdown --shutdown"
CMD_SETPATH="export PATH=$PATH:$JAVAPTH"
SUBIT="su - $JBOSSUS -c "
if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then
export PATH=$PATH:$JAVAPTH
fi
if [ ! -d "$JBOSS_HOME" ]; then
echo JBOSS_HOME does not exist as a valid directory : $JBOSS_HOME
exit 1
fi
case "$1" in
start)
echo -n "Starting JBoss application server: "
cd $JBOSS_HOME/bin
if [ -z "$SUBIT" ]; then
eval $CMD_START >${JBOSS_CONSOLE} 2>&1 &
else
$SUBIT "$CMD_SETPATH; $CMD_START >${JBOSS_CONSOLE} 2>&1 &"
fi
;;
stop)
echo -n "Shutting down JBoss application server: "
if [ -z "$SUBIT" ]; then
$CMD_STOP
else
$SUBIT "$CMD_SETPATH; $CMD_STOP"
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "usage: $0 (start|stop|restart|help)"
esac
I'm invoking rc.jboss stop from /etc/rc.d/rc.6 and /etc/rc.d/rc.K like this:
Code:
if [ -x /etc/rc.d/rc.jboss ]; then
/etc/rc.d/rc.jboss stop
fi
and invoking rc.jboss start from /etc/rc.d/rc.M like this:
Code:
if [ -x /etc/rc.d/rc.jboss ]; then
. /etc/rc.d/rc.jboss start
fi
Everything seems to be working fine. My question is why do I have to invoke
Code:
$SUBIT "$CMD_SETPATH; $CMD_START"
rather than
Code:
$SUBIT "$CMD_START"
If I don't set the path after suing to jboss, then I get an error from the jboss run.sh script saying it can't find the java command.
Also, what does the "." in ". /etc/rc.d/rc.jboss start" in rc.M do for me (I just copied it since that's what they're doing with everything else like rc.http, etc)?
Thanks!