Skip to content

Instantly share code, notes, and snippets.

@halilim
Last active February 26, 2019 17:16
Show Gist options
  • Save halilim/9348080 to your computer and use it in GitHub Desktop.
Save halilim/9348080 to your computer and use it in GitHub Desktop.
CentOS sphinx searchd service init.d template

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment