#! /bin/sh # /etc/init.d/sphinx: start the sphinx search daemon. PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin PIDFILE=/opt/local/var/db/sphinx/log/searchd.pid BINPATH=/usr/local/bin/searchd SPHINX="--config /etc/sphinx/sphinx.conf" NAME=searchd DESC="sphinx search daemon" test -f $BINPATH || exit 0 # Debian/Ubuntu style # test ! -r /etc/default/sphinx || . /etc/default/sphinx running() { # No pidfile, probably no daemon present # if [ ! -f $PIDFILE ] then return 1 fi pid=`cat $PIDFILE` # No pid, probably no daemon present # if [ -z "$pid" ] then return 1 fi if [ ! -d /proc/$pid ] then return 1 fi cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1` # No syslogd? # if [ "$cmd" != "$BINPATH" ] then return 1 fi return 0 } case "$1" in start) echo -n "Starting sphinx search daemon: searchd" start-stop-daemon --start --quiet --chuid www-data:www-data --exec $BINPATH -- $SPHINX echo "." ;; stop) echo -n "Stopping sphinx search daemon: searchd" start-stop-daemon --stop --chuid www-data:www-data --retry TERM/1/TERM/1/TERM/4/KILL --quiet --exec $BINPATH --pidfile $PIDFILE #start-stop-daemon --stop --chuid www-data:www-data --retry TERM/1/TERM/1/TERM/4/KILL --pidfile $PIDFILE echo "." ;; restart|force-reload) echo -n "Restarting sphinx search daemon: searchd" start-stop-daemon --stop --chuid www-data:www-data --retry TERM/1/TERM/1/TERM/4/KILL --quiet --exec $BINPATH --pidfile $PIDFILE #start-stop-daemon --stop --chuid www-data:www-data --retry TERM/1/TERM/1/TERM/4/KILL --pidfile $PIDFILE start-stop-daemon --start --chuid www-data:www-data --quiet --exec $BINPATH -- $SPHINX echo "." ;; *) echo "Usage: /etc/init.d/shpinx {start|stop|restart|force-reload}" exit 1 esac exit 0