[shell]管理 Sphinx 启动|停止|重新生成索引的脚本

对于启动sphinx的服务,可以直接输入如下命令

 /usr/bin/searchd -c /etc/sphinx/sphinx.conf

<!-- /usr/local/bin/searchd -c /etc/sphinx.conf -->

下面是写成脚本的方式方便以后维护

因为工作需要,所以把管理 Sphinx 的相关操作写成一个管理脚本,方便日常使用。

 

[plain]  view plain  copy
 
  1. #!/bin/sh  
  2. #file: /usr/local/bin/sphinx  
  3. #  
  4. #~ power by yagas60@21cn.com  
  5. #~ blog: http://blog.csdn.net/yagas  
  6.   
  7.   
  8. . /etc/rc.d/init.d/functions  
  9.   
  10. appName="Sphinx"  
  11.   
  12. stop(){  
  13.     /usr/local/bin/searchd -c /usr/local/coreseek/etc/sphinx.conf --stop > /dev/null 2>&1   
  14.         ret=$?  
  15.         if [ $ret -eq 0 ]; then  
  16.             action $"Stoping $appName: " /bin/true  
  17.         else  
  18.             action $"Stoping $appName: " /bin/false  
  19.         fi  
  20.     return $ret  
  21. }  
  22.   
  23. start(){  
  24.     /usr/local/bin/searchd -c /usr/local/coreseek/etc/sphinx.conf > /dev/null 2>&1   
  25.         ret=$?  
  26.         if [ $ret -eq 0 ]; then  
  27.             action $"Starting $appName: " /bin/true  
  28.         else  
  29.             action $"Starting $appName: " /bin/false  
  30.         fi  
  31.     return $ret  
  32. }  
  33.   
  34. indexer(){  
  35.         /usr/local/bin/indexer -c /usr/local/coreseek/etc/sphinx.conf --all > /dev/null 2>&1  
  36.     ret=$?  
  37.         if [ $ret -eq 0 ]; then  
  38.             action $"$appName making index: " /bin/true  
  39.         else  
  40.             action $"$appName making index: " /bin/false  
  41.         fi  
  42.         return $ret  
  43. }  
  44.   
  45.   
  46. case $1 in  
  47.     restart)  
  48.     stop  
  49.     indexer  
  50.     start  
  51.     ;;  
  52.   
  53.     stop)  
  54.     stop  
  55.     ;;  
  56.       
  57.     start)  
  58.     start  
  59.     ;;  
  60. esac  
  61.   
  62. exit 0  


使用方法:

 

启动服务 sphinx start

停止服务 sphinx stop

重新生成搜索 sphinx restart

 

文章摘自http://blog.csdn.net/yagas/article/details/6718532

转载于:https://www.cnblogs.com/jasonxu19900827/p/5282291.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值