Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > 5476648a605140ffaec58f0395c11144 > files > 2

sphinx-0.9.8-3mdv2008.1.x86_64.rpm

#!/bin/bash
#
# sphinx-searchd	This shell script takes care of starting and stopping sphinx-searchd.
#
# chkconfig: 345 55 45
# description: sphinx-searchd is a daemon which enables external \
# software (eg. Web applications) to search through fulltext indexes
# processname: sphinx-searchd
# config: /etc/sphinx/sphinx.conf
# config: /etc/sysconfig/sphinx-searchd
# pidfile: /var/run/sphinx-searchd.pid

### BEGIN INIT INFO
# Provides: sphinx-searchd
# Required-Start: $network
# Should-Start: mysqld postgresql
# Required-Stop: $network
# Should-Stop: mysqld postgresql
# Default-Start: 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop sphinx-searchd
# Description: Free open-source SQL full-text search engine.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0

[ -f /etc/sphinx/sphinx.conf ] || exit 0

[ -f /usr/sbin/sphinx-searchd ] || exit 0

[ -f /etc/sysconfig/sphinx-searchd ] && . /etc/sysconfig/sphinx-searchd

RETVAL=0

start() {
	if [ -n "`/sbin/pidof sphinx-searchd`" ]; then
            gprintf "sphinx-searchd: already running"
	    echo
            return 1
        fi
	gprintf "Starting sphinx-searchd: "
	daemon sphinx-searchd \
	${SPHINX_CONFIG_FILE:-"--config /etc/sphinx/sphinx.conf"} \
	${SPHINX_OPTIONS:-""} >/dev/null 2>&1
	RETVAL=$?
	[ $RETVAL = 0 ] && success || failure
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/sphinx-searchd
	return $RETVAL
}

stop() {
	gprintf "Stopping sphinx-searchd: "
	killproc sphinx-searchd 2>/dev/null
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sphinx-searchd
	return $RETVAL
}	

rhstatus() {
	status ntpd
}	

restart() {
  	stop
	start
}	

reload() {
	gprintf "Reloading sphinx-searchd daemon configuration: "
	killproc sphinx-searchd -HUP
	retval=$?
	echo
	return $RETVAL
}	

case "$1" in
  start)
  	start
	;;
  stop)
  	stop
	;;
  restart)
  	restart
	;;
  reload)
  	reload
	;;
  status)
  	rhstatus
	;;
  condrestart)
  	[ -f /var/lock/subsys/sphinx-searchd ] && restart || :
	;;
  *)
	gprintf "Usage: %s {start|stop|status|reload|restart|condrestart}\n" "$0"
	exit 1
esac

exit $?