您好,欢迎访问一九零五行业门户网

【实战】sphinx启动关闭管理脚本

#!/bin/sh#/usr/local/sphinx/bin/##ocpyang@126.comsphinx_pidfile=/usr/local/sphinx/var/log/searchd.pidif [ -e ${sphinx_pidfile} ] ; thensphinx_active=1 #runing#echo ${sphinx_active}elsesphinx_active=0 #close #echo ${sphinx_active}fistop(){i
#!/bin/sh#/usr/local/sphinx/bin/##ocpyang@126.comsphinx_pidfile=/usr/local/sphinx/var/log/searchd.pidif [ -e ${sphinx_pidfile} ] ; then sphinx_active=1 #runing #echo ${sphinx_active}else sphinx_active=0 #close #echo ${sphinx_active}fistop(){if [ ${sphinx_active} -eq 0 ];then echo -e '\e[31m sphinx has been turned off \e[m' #红色 exit 1else /usr/local/sphinx/bin/searchd --config /usr/local/sphinx/etc/sphinx.conf --stop > /dev/null 2>&1 resu=$? if [ ${resu} -eq 0 ]; then echo -e '\e[32m******************************************************************** \e[m' #绿色 echo -e '\e[32m( ^_^ ) sphinx stop sucess( ^_^ ) \e[m' #绿色 echo -e '\e[32m******************************************************************** \e[m' #绿色 else echo -e '\e[31m******************************************************************** \e[m' #红色 echo -e '\e[31m !o(︶︿︶)o!sphinx stop fail! ~~~~(>_ /dev/null 2>&1 resu=$? if [ ${resu} -eq 0 ]; then echo -e '\e[32m******************************************************************** \e[m' #绿色 echo -e '\e[32m ( ^_^ )sphinx start sucess( ^_^ ) \e[m' #绿色 echo -e '\e[32m******************************************************************** \e[m' #绿色 else echo -e '\e[31m******************************************************************** \e[m' #红色 echo -e '\e[31m !o(︶︿︶)o!sphinx start fail! ~~~~(>_ /dev/null 2>&1 resu=$? if [ ${resu} -eq 0 ]; then echo -e '\e[32m******************************************************************** \e[m' #绿色 echo -e '\e[32m ( ^_^ )sphinx indexer_all sucess( ^_^ ) \e[m' #绿色 echo -e '\e[32m******************************************************************** \e[m' #绿色 else echo -e '\e[31m******************************************************************** \e[m' #红色 echo -e '\e[31m !o(︶︿︶)o!sphinx indexer_all fail! ~~~~(>_ /dev/null 2>&1 resu=$? if [ ${resu} -eq 0 ]; then echo -e '\e[32m******************************************************************** \e[m' #绿色 echo -e '\e[32m ( ^_^ )sphinx indexer_online sucess( ^_^ ) \e[m' #绿色 echo -e '\e[32m******************************************************************** \e[m' #绿色 else echo -e '\e[31m******************************************************************** \e[m' #红色 echo -e '\e[31m !o(︶︿︶)o!sphinx indexer_online fail! ~~~~(>__<)~~~~ \e[m' #红色 echo -e '\e[31m********************************************************************* \e[m' #红色 fi return ${resu}fi}case $1 in restart) stop start ;; stop) stop ;; start) start ;; indexer_all) indexer_all ;; indexer_online) indexer_online ;; status) status ;;esacexit 0
其它类似信息

推荐信息