最新sphin问题比较多,生成主索引后无法连接上sphinx的,需要重启searchd进程,为了方便管理sphinx,参考网上资料:http://blog.csdn.net/yagas/article/details/6718532 修改一个适合自己的sphinx管理脚本。
[codesyntax lang="bash"]
#!/bin/bash
. /etc/rc.d/init.d/functions
appName="Sphinx"
coreseek_dir="/usr/local/coreseek"
config="/usr/local/coreseek/etc/csft.conf"
stop(){
${coreseek_dir}/bin/searchd -c ${config} --stop > /dev/null 2>&1
ret=$?
if [ $ret -eq 0 ]; then
action $"Stoping $appName: " /bin/true
else
action $"Stoping $appName: " /bin/false
fi
return $ret
}
start(){
${coreseek_dir}/bin/searchd -c ${config} > /dev/null 2>&1
ret=$?
if [ $ret -eq 0 ]; then
action $"Starting $appName: " /bin/true
else
action $"Starting $appName: " /bin/false
fi
return $ret
}
indexer(){
${coreseek_dir}/bin/indexer -c ${config} --all > /dev/null 2>&1
ret=$?
if [ $ret -eq 0 ]; then
action $"$appName making index: " /bin/true
else
action $"$appName making index: " /bin/false
fi
return $ret
}
case $1 in
restart)
stop
start
;;
indexer)
stop
indexer
start
;;
stop)
stop
;;
start)
start
;;
esac
exit 0
[/codesyntax]