I built and installed sphinx search on my ubuntu 9.04 server.
How do I make the sphinx daemon start automatically when I reboot?
I built and installed sphinx search on my ubuntu 9.04 server.
How do I make the sphinx daemon start automatically when I reboot?
I don't know Sphinx, but here's the basic approach. Create a file /etc/init.d/searchd with the following contents (there's also this script, but you'll probably need to adjust it a bit):
Then execute the following:
To control the service manually:
We deployed Sphinx for a customer on Debian systems, and used Runit to manage the processes. We didn't have to write a special init script, and since we were using Runit on other platforms (CentOS/RHEL mainly) it was perfectly portable.
The version of sphinx that is packaged for ubuntu at time of writing (0.99) has the startup script below.
I re-used it for the 2.0.1 beta which I compiled from source, just changing the line
DAEMON=/usr/local/..
and it works for me.Add a restart script to /etc/init.d directory.
I don't really know sphinx, but judging by the online manual, you need to have a startup script to run the daemon. Typically this is done by creating an entry in /etc/init.d and linking it into the appropriate /etc/rcX.d directory. Check the README file in /etc/init.d for details.
If nothing else, something like this is the quick and dirty answer:
Create a short script file (bash, perhaps) that has the equivalent of the following line in it:
/path/to/sphinx/installation/searchd --config /path/to/sphinx/config/sphinx.conf &
Then move the script to /etc/init.d as root, and chmod the script ("chmod +x myscript.sh")
I would suggest an even simpler solution:
Just add /usr/bin/searchd to /etc/rc.local before the line that says exit 0
If you happen to use sphinx in your rails application is a dead easy way to manage this with the whenever gem.
Ryan Bates made a very good screencast about it. This site won't let me put more than one link here but I recommend it.
Take a look at this forum post: http://sphinxsearch.com/forum/view.html?id=3568#18044
Basically you can add a cron job that will start Sphinx on reboot by executing this from the command line:
crontab -e
Then add the following:
@reboot searchd --config /path/to/config.conf