The first thing to understand is that Linux executes the /etc/rc.local script file when it starts

So we need to do this:


[root@m /]# vim /etc/rc.local

Then place the Sphinx indexing and startup commands in this file, as follows:


touch /var/lock/subsys/local #create index /usr/local/bin/indexer -c /usr/local/etc/sphinx.conf –rotate –all #open searchd /usr/local/bin/searchd -c /usr/local/etc/sphinx.conf

At this point, we seem to be done, but we’re ignoring a big problem that we’ve been working on for a long time: in order for the system to execute these commands, it has to give the file executable permissions


[root@m etc]# chmod +x rc.local

Then restart the server to see if Sphinx is started


[root@m etc]# ps aux | grep searchd

After rebooting, Sphinx starts!