Sha256: 7cc92af670df9c3b332a412dde581eb7a6665911cfa9412cb8fcb0cebc60e307

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

#! /bin/sh
# sphinx: Sphinx search daemon for <%= application %>
#
# chkconfig: - 86 14
# description: sphinx search daemon
# processname: searchd
#
# Author: Gabriel Handford http://ducktyper.com

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

RETVAL=0

DESC="sphinx daemon (<%= application %>)"
NAME=searchd
DAEMON=<%= sphinx_prefix %>/bin/searchd
CONFIGFILE=<%= sphinx_conf_path %>
PIDFILE=<%= sphinx_pid_path %>
INDEX_DIR=<%= sphinx_index_root %>

start() {
  daemon --user <%= user %> $DAEMON --config $CONFIGFILE
  RETVAL=$?
  echo
  return $RETVAL;  
}

stop() {
  kill -QUIT `cat $PIDFILE` || echo -n " not running"
}

reload() {
  kill -HUP `cat $PIDFILE` || echo -n " can't reload"
}

clean() {
  pid=`cat $PIDFILE`
  
  if checkpid $pid; then
    echo -n " can't clean; running"
  else
    rm -f $INDEX_DIR/*.spl
    return $?
  fi
  return 1 
}

case "$1" in
  start)
  	echo -n "Starting $DESC: $NAME"
  	start
    RETVAL=$?;
	;;
  stop)
  	echo -n "Stopping $DESC: $NAME"
  	stop
  	RETVAL=$?;
	;;
  reload)
  	echo -n "Reloading $DESC configuration..."
  	reload
  	RETVAL=$?;
  	echo "reloaded."
  ;;
  restart)
  	echo -n "Restarting $DESC: $NAME"
  	stop
  	# Sleep after stop
  	sleep 1
  	start
  	RETVAL=$?;
	;;
	clean)
    echo -n "Cleaning $DESC"
    clean
    RETVAL=$?;
    ;;
  *)
	  echo "Usage: $0 {start|stop|restart|force-reload}" >&2
	  RETVAL=3;
	;;
esac

exit $RETVAL;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capitate-0.2.7 lib/templates/sphinx/sphinx_app.initd.centos.erb
capitate-0.2.8 lib/templates/sphinx/sphinx_app.initd.centos.erb