Daemontools scripts for sphinx Feb 07
Here are scripts to use daemontools to manage sphinx.
The run script (/service/sphinx/run):
#!/bin/sh
echo starting
exec 2>&1
exec /usr/local/bin/searchd --console --config /var/www/example.com/current/config/sphinx/production.conf
the --console flag is key: it keeps searchd running in the foreground.
The log/run script is standard (/service/sphinx/log/run):
#!/bin/sh
exec multilog t ./main
And finally a script to reindex everything:
#!/bin/sh
/usr/local/bin/svstat /service/sphinx | awk -F ')| ' '{print $4}' > /var/www/example.com/current/tmp/pids/searchd.pid
/usr/local/bin/indexer --config /var/www/example.com/current/config/sphinx/production.conf --all --rotate
The searchd.pid file is referenced in the sphinx production.conf file and is used by indexer. It would be nice to just call indexer --all and then svc -h /service/sphinx, but indexer requires the --rotate flag to reindex without taking searchd offline, so you have to do the awk junk to get the pid first.
Add a comment