680N/A#!/sbin/sh
680N/A#
680N/A# CDDL HEADER START
680N/A#
680N/A# The contents of this file are subject to the terms of the
680N/A# Common Development and Distribution License (the "License").
680N/A# You may not use this file except in compliance with the License.
680N/A#
680N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
680N/A# or http://www.opensolaris.org/os/licensing.
680N/A# See the License for the specific language governing permissions
680N/A# and limitations under the License.
680N/A#
680N/A# When distributing Covered Code, include this CDDL HEADER in each
680N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
680N/A# If applicable, add the following below this CDDL HEADER, with the
680N/A# fields enclosed by brackets "[]" replaced with your own identifying
680N/A# information: Portions Copyright [yyyy] [name of copyright owner]
680N/A#
680N/A# CDDL HEADER END
680N/A#
964N/A# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
680N/A# Use is subject to license terms.
680N/A#
680N/A
680N/A. /lib/svc/share/smf_include.sh
680N/A
964N/Asrcdir=`svcprop -p opengrok/srcdir opengrok`
964N/Apipe=/var/opengrok/.refresh.pipe
680N/A
964N/Aif [ "$srcdir" = "none" ]; then
964N/A echo "FATAL: please set srcdir property" >&2
964N/A exit $SMF_EXIT_ERR_CONFIG
680N/Afi
680N/A
964N/Aif [ ! -d "$srcdir" ]; then
964N/A echo "FATAL: srcdir $srcdir doesn't exist" >&2
964N/A exit $SMF_EXIT_ERR_CONFIG
683N/Afi
683N/A
680N/Acase "$1" in
964N/A 'start')
964N/A echo starting
964N/A /usr/opengrok/lib/ogindexd &
964N/A ;;
964N/A
964N/A 'stop')
964N/A smf_kill_contract $2 TERM 1
964N/A ;;
680N/A
964N/A 'refresh')
964N/A if [ ! -p "$pipe" ]; then
964N/A echo "FATAL: $pipe doesn't exist yet." >&2
964N/A echo "Is service running?" >&2
964N/A exit $SMF_EXIT_ERR_CONFIG
964N/A fi
964N/A echo > "$pipe"
964N/A ;;
680N/A
964N/A *)
964N/A echo "Usage: $0 {start|stop}"
964N/A exit 1
964N/A ;;
680N/Aesac
680N/A
680N/Aexit $SMF_EXIT_OK