Quantcast
Channel: linux运维小站–linux系统架构_服务器运维_Linux运维工程师工作手札
Viewing all articles
Browse latest Browse all 130

sphinx管理脚本,实现sphinx启动、关闭、重启、生成索引功能

$
0
0

最新sphin问题比较多,生成主索引后无法连接上sphinx的,需要重启searchd进程,为了方便管理sphinx,参考网上资料:http://blog.csdn.net/yagas/article/details/6718532   修改一个适合自己的sphinx管理脚本。

#!/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


Viewing all articles
Browse latest Browse all 130

Trending Articles