#!/bin/sh ## ## ### BEGIN INIT INFO # Provides: sphinxsearch # Required-Start: $remote_fs $syslog $named $network $time # Required-Stop: $remote_fs $syslog $named $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: sphinxsearch # Description: sphinxsearch ### END INIT INFO export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin NAME=searchd PID_FILE=/var/run/piler/searchd.pid PID_NUMBER=`test -f ${PID_FILE} && cat ${PID_FILE}` start() { echo "starting searchd . . ." if [ `id -u` -eq 0 ]; then su piler -c searchd else searchd fi } stop() { echo "stopping searchd" kill ${PID_NUMBER} } check_status(){ test -f /proc/${PID_NUMBER}/status } case "$1" in start) start; ;; stop) stop; ;; status) if check_status; then echo "${NAME} is running." else echo "${NAME} is not running." fi ;; restart) stop; sleep 1; start; ;; *) echo "Usage: $0 start|stop|restart|status" esac