Hi,
yes, got the script from there, and adopted it to our server.
Just tried a bit more:
case "$1" in
start)
ps -ef | grep -v grep | grep $GEOSERVER_DATA_DIR
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
;;
in the start-section of the script the ps -ef-command just doesnt work, it
doesn't get the correct RETVAL and starts a new instance of geoserver each
time I start the script. The GEOSERVER_DATA_DIR-variable is defined as it
should be.
When changing the command to
ps -ef | grep -v grep | grep geoserver
the following output is presented:
root 31717 30746 0 09:55 pts/2 00:00:00 /bin/sh /sbin/service
geoserver start
root 31719 31717 0 09:55 pts/2 00:00:00 /bin/sh
/etc/init.d/geoserver start
geoserver is already running
So the script starts the command, and it gets the correct RETVAL, it just
doesn't work when it should use the geoserver_data_dir-variable.
When I start the ps -ef directly from the shell it realises that there are
instances of geoserver:
# ps -ef | grep -v grep | grep /opt/geoserver/data_dir
root 405 1 3 10:20 ? 00:00:10 /usr/lib64/jvm/jre/bin/java
-server -DGEOSERVER_DATA_DIR=/opt/geoserver/data_dir
-Djava.awt.headless=true -Djetty.port=7070 -DSTOP.PORT=7069
-DSTOP.KEY=geoserver -jar start.jar
root 694 1 12 10:24 pts/2 00:00:10 /usr/lib64/jvm/jre/bin/java
-server -DGEOSERVER_DATA_DIR=/opt/geoserver/data_dir
-Djava.awt.headless=true -Djetty.port=7070 -DSTOP.PORT=7069
-DSTOP.KEY=geoserver -jar start.jar
#
Sometimes it gets it, and the script works as it should, but after logging
out an in back again, all of this starts again.
Confused
Dennis.
2011/6/14 <[email protected]>
> Zitat von Dennis Hesse BAW <[email protected]>:
>
> hmm.. didn't help:
>>
>> # service geoserver status
>> geoserver is not running.
>> # echo $GEOSERVER_DATA_DIR
>>
>> #
>>
>> After an export, shoudn't echo $GEOSERVER_DATA_DIR give an output to the
>> shell?
>>
>
> No, export enables access to the variable for the child processes, in your
> case to the init script and all child processes of the init script. After
> the init script finished, your var is gone.
>
> Did you have a look at
> http://docs.geoserver.org/stable/en/user/production/linuxscript.html
>
>
>
>
>> Any other idea?
>>
>>
>> Thanks
>> Dennis.
>>
>> 2011/6/10 <[email protected]>
>>
>> Try
>>>
>>> export GEOSERVER_DATA_DIR=/opt/geoserver/data_dir
>>>
>>> instead of
>>>
>>>
>>> GEOSERVER_DATA_DIR=/opt/geoserver/data_dir
>>>
>>> Cheers
>>> Christian
>>>
>>>
>>> Zitat von Dennis Hesse BAW <[email protected]>:
>>>
>>> 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/>
>>>>
>>>>
>>>>
>>>
>>> ----------------------------------------------------------------
>>> This message was sent using IMP, the Internet Messaging Program.
>>>
>>>
>>>
>>
>> --
>>
>> 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/>
>>
>>
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
>
--
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