Hi,

I'm experiencing a strange behaviour with the geoserver start script.

I'm runnig geoserver 2.1 on a Suse SLES11 SP1, geoserver is installed
without tomcat.

I'm using the following script:

#!/bin/sh
#
# /etc/init.d/tgtd
#
### BEGIN INIT INFO
# Provides:          geoserver
# Required-Start:    $remote_fs $network
# Should-Start:
# Required-Stop:     $remote_fs $network
# Should-Stop:
# Default-Start:     3 5
# Default-Stop:
# Short-Description: geoserver test deployment
# Description:       Starts and stops geoserver
### END INIT INFO

#
#


# Source LSB init functions
. /etc/rc.status

rc_reset


PORT=7070
#echo $PORT
STOPPORT=7069
#echo $STOPPORT
#SUFFIX=_test

PATH=/sbin:/bin:/usr/sbin:/usr/bin
#echo $PATH
NAME=geoserver
#echo $NAME
SCRIPTNAME=/etc/init.d/$NAME
#echo $SCRIPTNAME
LOCKFILE="/var/lock/subsys/${NAME}"
#echo $LOCKFILE
RETVAL=0
#echo $RETVAL

JAVA_HOME=/usr/lib64/jvm/jre
#echo $JAVA_HOME
GEOSERVER_DATA_DIR=/opt/geoserver/data_dir
#echo $GEOSERVER_DATA_DIR
GEOSERVER_USER=root
#echo $GEOSERVER_USER
GEOSERVER_HOME=/opt/geoserver
#echo $GEOSERVER_HOME


# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME



case "$1" in
  start)
    ps -ef | grep -v grep |  grep "${GEOSERVER_DATA_DIR}"  #> /dev/null
        RETVAL=$?
        if [ $RETVAL -eq 0 ]; then
        echo "${NAME} is already running "
    else
        echo  "Starting ${NAME} "
        echo `date` >> $GEOSERVER_DATA_DIR/serverlog
        cd "$GEOSERVER_HOME"
        su "$GEOSERVER_USER" -c "$JAVA_HOME/bin/java -server
-DGEOSERVER_DATA_DIR=$GEOSERVER_DATA_DIR -Djava.awt.headless=true
-Djetty.port=$PORT -DSTOP.PORT=$STOPPORT -DSTOP.KEY=geoserver -jar start.jar
>> $GEOSERVER_DATA_DIR/serverlog 2>&1 &"

        RETVAL=$?
        if [ $RETVAL -eq 0 ]; then
            touch "${LOCKFILE}"
        else
            echo "Failure starting  ${NAME}"
        fi
    fi
        ;;
  stop)
        ps -ef | grep -v grep |  grep "${GEOSERVER_DATA_DIR}"  #> /dev/null
        RETVAL=$?
        if [ $RETVAL -eq 0 ]; then
        echo  "Stopping ${NAME} "
            echo `date` >> $GEOSERVER_DATA_DIR/serverlog
        cd "$GEOSERVER_HOME"
        su "$GEOSERVER_USER" -c "$JAVA_HOME/bin/java -DSTOP.PORT=$STOPPORT
-DSTOP.KEY=geoserver -jar start.jar --stop >> $GEOSERVER_DATA_DIR/serverlog
2>&1"

            RETVAL=$?
            if [ $RETVAL -eq 0 ]; then
                    rm "${LOCKFILE}"
            else
                    echo "Failure stopping  ${NAME}"
            fi
    else
        echo "${NAME} is not running"
    fi
        ;;


  restart|reload)
        $0 stop
    sleep 5
        $0 start
        ;;
  status)
    ps -ef | grep -v grep | grep /opt/geo
        RETVAL=$?
    if [ $RETVAL -eq 0 ]; then
            echo "$NAME is running."
        else
            echo "$NAME is not running."
    fi

        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|status}"
        exit 1
esac
rc_exit

The problem I've got is that the script doesn't work properly. Sometimes it
does just what it should do, but the next moment the restart-command just
tells me that the geoserver isn't running. ps -ef | grep -v grep | grep
/opt/geo is producing an output telling geoserver is running even in that
case, the script just can't get this info. I've had an echo $RETVAL written
in, and the script returned 1 in that case.

Hope you can follow me and can tell me what is going wrong here?

Thanks
Dennis.
-- 

Dennis Hesse
Bundesanstalt für Wasserbau Dienststelle Hamburg
Wedeler Landstraße 157 22559 Hamburg
Tel.: 040 81908-0 E-mail: [email protected]
Webseiten: BAW <http://www.baw.de/de/index.php.html>  ||
MDI-DE<http://www.mdi-de.org/>
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to