#!/bin/sh
#file: /usr/local/bin/sphinx
#
#~ power by yagas60@21cn.com
#~ blog: http://blog.csdn.net/yagas


. /etc/rc.d/init.d/functions

appName="Sphinx"

stop(){
  /usr/local/bin/searchd -c /usr/local/coreseek/etc/sphinx.conf --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(){
  /usr/local/bin/searchd -c /usr/local/coreseek/etc/sphinx.conf > /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(){
        /usr/local/bin/indexer -c /usr/local/coreseek/etc/sphinx.conf --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
  indexer
  start
  ;;

  stop)
  stop
  ;;
  
  start)
  start
  ;;
esac

exit 0

来源:http://blog.csdn.net/yagas/article/details/6718532

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。