Auto start Sphinx searchd after reboot on Linux

By default, after you install and configure Sphinx, you will find that once your OS restarts, search will not be working. That is because searchd is not setup to auto start. The following will solve that problem.

Create file /etc/init.d/searchd.
sudo vi /etc/init.d/searchd

Copy the following into searchd.
#!/bin/bash

case “${1:-”}” in
‘start’)
/usr/local/bin/searchd
;;
‘stop’)
/usr/local/bin/searchd –stop
;;
‘restart’)
/usr/local/bin/searchd –stop && /usr/local/bin/searchd
;;
*)
echo “Usage: $SELF start|stop|restart”
exit 1
;;
esac

Add execute to the file
sudo chmod -x /etc/init.d/searchd

Register with auto start
sudo update-rc.d searchd defaults