Installation (put the name of your app in place of example
here and in the script):
nano /etc/init.d/searchd_example
# Paste the script
chmod a+x /etc/init.d/searchd_example
chkconfig searchd_example on
/etc/init.d/searchd_example start
#!/bin/bash | |
# | |
# chkconfig: 2345 95 20 | |
# description: Sphinx searchd for example app. | |
# processname: searchd_example | |
SEARCHD=/usr/local/bin/searchd | |
CONF=/home/user/app/sphinx.conf | |
# Source function library. | |
. /etc/init.d/functions | |
case "${1:-''}" in | |
'start') | |
$SEARCHD -c $CONF | |
;; | |
'stop') | |
$SEARCHD -c $CONF --stop | |
;; | |
'restart') | |
$SEARCHD -c $CONF --stopwait && $SEARCHD -c $CONF | |
;; | |
*) | |
echo "Usage: $SELF start|stop|restart" | |
exit 1 | |
;; | |
esac |