69N/A#! /bin/sh
69N/A# CDDL HEADER START
69N/A#
69N/A# The contents of this file are subject to the terms of the
69N/A# Common Development and Distribution License (the "License").
69N/A# You may not use this file except in compliance with the License.
69N/A#
69N/A# See LICENSE.txt included in this distribution for the specific
69N/A# language governing permissions and limitations under the License.
69N/A#
69N/A# When distributing Covered Code, include this CDDL HEADER in each
69N/A# file and include the License file at LICENSE.txt.
69N/A# If applicable, add the following below this CDDL HEADER, with the
69N/A# fields enclosed by brackets "[]" replaced with your own identifying
69N/A# information: Portions Copyright [yyyy] [name of copyright owner]
69N/A#
69N/A# CDDL HEADER END
69N/A#
69N/A# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
69N/A# Use is subject to license terms.
69N/A
69N/Acd ${ROOT}
69N/Aif [ ! -f ${ROOT}/smf/next ]
69N/Athen
69N/A echo 1 > smf/next
69N/Afi
69N/A
69N/Aread stage < smf/next
69N/A
69N/Aoutput=/tmp/opengrok.$$
69N/A
69N/Asend_report()
69N/A{
69N/A if [ -n "${ADMINISTRATOR}" ]
69N/A then
69N/A mailx -s "{OpenGrok update failed" ${ADMINISTRATOR} < ${output}
69N/A fi
69N/A}
69N/A
69N/APROGDIR=${ROOT}/bin
69N/Aexport PROGDIR
69N/A
69N/Awhile true
69N/Ado
69N/A SRC_ROOT=${ROOT}/stage${stage}/source; export SRC_ROOT
69N/A DATA_ROOT=${ROOT}/stage${stage}/data; export DATA_ROOT
69N/A
69N/A # update source code
69N/A rm -f ${output}
69N/A ./smf/update_source.sh > ${output} 2>&1
69N/A if [ $? -ne 0 ]
69N/A then
69N/A send_report
69N/A else
69N/A # (re)generate index database
109N/A echo "Update index database" >> ${output}
109N/A # You may want to add something like the following command
109N/A # to automatically generate projects for each subdirectory in the
109N/A # SRC_ROOT directory. The -p options let you specify the project
109N/A # that should be selected by default (note that the parameter here
109N/A # is the path to the project)
115N/A # ADD_PROJECTS="-S -P -p /onnv-gate -W ${DATA_ROOT}/../configuration.xml"
69N/A ${JAVA_HOME}/bin/java -Xmx1524m -jar ${PROGDIR}/opengrok.jar \
109N/A -H -R ${DATA_ROOT}/../configuration.xml \
109N/A ${ADD_PROJECTS} >> ${output} 2>&1
69N/A
69N/A if [ $? -ne 0 ]
69N/A then
69N/A send_report
69N/A else
69N/A rm -f configuration.xml
69N/A ln -s stage${stage}/configuration.xml
69N/A
69N/A # notify web-servers
69N/A if [ -n "$WEBSERVERS" ]
69N/A then
69N/A for f in $WEBSERVERS
69N/A do
69N/A # Use rsync to populate the files out to the web server
69N/A # rsync -a configuration.xml stage${stage} \
69N/A # /net/`echo $f|cut -f1 -d:`/opengrok/
69N/A # if [ $? -eq 0 ]
69N/A # then
69N/A
69N/A # Tell the web server to use the new configuration
69N/A ${JAVA_HOME}/bin/java -Xmx1524m \
69N/A -jar ${PROGDIR}/opengrok.jar \
69N/A -U ${f} \
109N/A -R ${DATA_ROOT}/../configuration.xml \
109N/A -n >> ${output} 2>&1
69N/A # fi
69N/A
69N/A done
69N/A fi
69N/A
69N/A # update running configuration
69N/A if [ "${stage}" = 1 ]
69N/A then
69N/A stage=2
69N/A else
69N/A stage=1
69N/A fi
69N/A echo ${stage} > smf/next
69N/A fi
69N/A fi
69N/A sleep ${SLEEPTIME}
69N/Adone