[jboss-user] problem to start JBOSS as service with redhat
Hui Zhao
zhaoh at cbio.mskcc.org
Thu Oct 16 23:03:46 EDT 2008
I refer to the following link to setup JBOSS run as a service.
> http://www.jboss.org/community/docs/DOC-12305
> How do I Start JBoss on boot with Linux?
I tried both script on this page and the one under jboss-4.0.5.GA/bin/
jboss_init_redhat.sh. When I do (ps -ef | grep jboss), no process
shows up. I would be really appreciate if someone can give me some
advice.
Thanks,
Below is my script. I masked the ip address.
#!/bin/sh
JBOSS_HOME=${JBOSS_HOME:-"/srv/caGrid/lsd/apps/ncia4/jboss-4.0.5.GA/"}
#define the user under which jboss will run, or use 'RUNASIS' to run
as the current user
JBOSS_USER=${JBOSS_USER:-"jboss"}
#make sure java is in your path
#JAVAPTH=${JAVAPTH:-"/usr/java/jdk1.5.0_16/bin"}
JAVAPTH=${JAVAPTH:-"$JAVA_HOME/bin"}
#configuration to use, usually one of 'minimal', 'default', 'all'
JBOSS_CONF=${JBOSS_CONF:-"default"}
#bind address for jboss services, by default bind to *all* NICs
JBOSS_HOST=${JBOSS_HOST:-"140.xxx.xxx.xx"}
#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 $JBOSS_CONF -b
$JBOSS_HOST"}
if [ "$JBOSS_USER" = "RUNASIS" ]; then
SUBIT=""
else
SUBIT="su - $JBOSS_USER -c "
echo $SUBIT
fi
if [ -n "$JBOSS_CONSOLE" -a ! -d "$JBOSS_CONSOLE" ]; then
# ensure the file exists
touch $JBOSS_CONSOLE
if [ ! -z "$SUBIT" ]; then
chown $JBOSS_USER $JBOSS_CONSOLE
fi
fi
if [ -n "$JBOSS_CONSOLE" -a ! -f "$JBOSS_CONSOLE" ]; then
echo "WARNING: location for saving console log invalid:
$JBOSS_CONSOLE"
echo "WARNING: ignoring it and using /dev/null"
#JBOSS_CONSOLE="$JBOSS_HOME/log/jboss.log"
JBOSS_CONSOLE=${JBOSS_CONSOLE:-"$JBOSS_HOME/log/jboss.log"}
fi
#define what will be done with the console log
JBOSS_CONSOLE=${JBOSS_CONSOLE:-"$JBOSS_HOME/log/jboss.log"}
echo $JBOSS_CONSOLE
JBOSS_CMD_START="cd $JBOSS_HOME/bin; $JBOSSSH"
JBOSS_CMD_STOP=${JBOSS_CMD_STOP:-"java -classpath $JBOSSCP
org.jboss.Shutdown --shutdown"}
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
echo JBOSS_CMD_START = $JBOSS_CMD_START
case "$1" in
start)
echo "JBoss start.........."
cd $JBOSS_HOME/bin
if [ -z "$SUBIT" ]; then
eval $JBOSS_CMD_START >${JBOSS_CONSOLE} 2>&1 &
else
$SUBIT "$JBOSS_CMD_START >${JBOSS_CONSOLE} 2>&1 &"
echo "hi"
fi
;;
stop)
if [ -z "$SUBIT" ]; then
$JBOSS_CMD_STOP
else
$SUBIT "$JBOSS_CMD_STOP"
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "usage: $0 (start|stop|restart|help)"
esac
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20081016/36fca2ae/attachment.html
More information about the jboss-user
mailing list