Here is probably more what you are looking for.  Can somebody add this
to what JBoss ships?  The first section needs to be the last lines of 
<jboss_root>/bin/run.sh  The next section is a script called "jboss"
which you place in /etc/init.d  It is a generic script that does not
make use of the nice features that Linux has for start|stop scripts
but it will work on the most common flavors of Unix.  At the top
of both scripts you need the line 
JBOSS_ROOT=<where you installed jboss> 
example JBOSS_ROOT=/usr/local/jboss

    -Kent

---------------------run.sh---------------------------------------
JBOSS_ROOT=/usr/local/jboss  #At top of script

java $HOTSPOT $JAXP -classpath $JBOSS_CLASSPATH org.jboss.Main $@ & >
$JBOSS_ROOT/tmp/jboss.log 2>&1
echo "$!" > $JBOSS_ROOT/tmp/jboss.pid


--------------------/etc/init.d/jboss-----------------------------
#!/bin/sh
#
# jboss      This shell script takes care of starting and stopping
#            the JBoss server
#
# description: 
# processname: run.sh
# pidfile: 

# NOTE:  This script will be installed into the directory /etc/init.d
# on an Unix machine.  Thus its final pathname will be:
#   /etc/init.d/jboss

PATH=/sbin:/bin:/usr/bin:/usr/sbin:/usr/bsd

JBOSS_ROOT=/usr/local/jboss

BIN=${JBOSS_ROOT:?}/bin

test -d ${JBOSS_ROOT:?} || exit 0
test -d ${BIN:?} || exit 0

RETVAL=0

# FIXME: Should add an id check to make sure we are root
case "$1" in
  start)
    if [ -e $JBOSS_ROOT/tmp/jboss.pid ]; then
        pid=`cat $JBOSS_ROOT/tmp/jboss.pid`
        kill -0 $pid >/dev/null 2>&1
        if [ "$?" = "0" ]; then
            echo "JBoss server (pid $pid) is running"
            exit 1
        fi
    fi
    # This cd is critical because JBoss currently has problems if it is
    # not started from the jboss/bin directory
    cd $BIN
    $BIN/run.sh &
    exit 0
    ;;
  stop)
    if [ -e $JBOSS_ROOT/tmp/jboss.pid ]; then
        pid=`cat $JBOSS_ROOT/tmp/jboss.pid`
        kill -0 $pid >/dev/null 2>&1
        if [ "$?" = "0" ]; then
            kill $pid
            rm $JBOSS_ROOT/tmp/jboss.pid
            exit 0
        fi
        exit 1
    fi
    ;;
  restart|reload)
    if [ -e $JBOSS_ROOT/tmp/jboss.pid ]; then
        pid=`cat $JBOSS_ROOT/tmp/jboss.pid`
        kill $pid
    fi
    cd $BIN
    $BIN/run.sh &
    exit 0
    ;;
  status)
    if [ -e $JBOSS_ROOT/tmp/jboss.pid ]; then
        pid=`cat $JBOSS_ROOT/tmp/jboss.pid`
        kill -0 $pid >/dev/null 2>&1
        if [ "$?" = "0" ]; then
            echo "JBoss server (pid $pid) is running"
            exit 1
        fi
    fi
    echo "JBoss server is not currently running"
    exit 1
    ;;
  *)
    echo "Usage: jboss { start | stop | restart | status }"
    exit 1
esac

exit $RETVAL
------------------------------------------------------------------
Adam Heath wrote:
> 
> On Tue, 20 Nov 2001, Juergen Fiedler wrote:
> 
> > OK, this one _must_ be more trivial than it seems to me. I am starting
> > JBoss (under Linux) by calling 'run.sh &' in the bin/ directory of
> > JBoss. After that, I have about 50 threads that seem to be doing the
> > same thing: run org.jboss.Main.
> > Everything works quite fine. The only problem is: I don't know how to
> > shut the server down. Right now, I just do a 'killall java'. This only
> > works because JBoss is the only piece of Java based software on my
> > machine.
> > But there has to be a more elegant way to stop JBoss. Could anybody
> > please help me to figure out how to do it the right way?
> >
> > Thanks in advance,
> > Juergen
> 
> cd bin
> ./run.sh 1>stdout.log 2>stderr.log &
> echo $! > pid
> # do something here
> kill `cat pid`
> 
> The above is fairly standard shell programming.
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to