#!/bin/sh ## ## NAME=searchd PID_FILE=/var/piler/sphinx/searchd.pid PID_NUMBER=`test -f ${PID_FILE} && cat ${PID_FILE}` start() { echo "starting searchd . . ." su piler -c 'BINDIR/searchd' } stop() { echo "stopping searchd" killall ${NAME} } 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