"Combat" Sphinx start close Management script

Source: Internet
Author: User

#!/bin/sh#/usr/local/sphinx/bin/##[email protected]26.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 () {if ["${sp   hinx_active} "-eq 0];thenecho-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! ~ ~ ~ (>_<) ~ ~ ~ \e[m ' #红色 echo-e ' \e[31m***\e[m ' #红色 Fireturn ${resu}fi}start () {if ["${SPH Inx_active} "-eq 1];thenecho-e ' \e[31m SPHINX is already running \e[m ' #红色exit 1else/usr/local/sphinx/bin/searchd--c        onfig/usr/local/sphinx/etc/sphinx.conf >/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! ~ ~ ~ (>_<) ~ ~ ~ \e[m ' #红色 echo-e ' \e[31m******************************************************************** \e [m ' #红色 Fireturn ${resu}fi}indexer_all () {if ["${sphinx_active}"-eq 0];Thenecho-e ' \e[31m SPHINX has been turned off \e[m ' #红色exit 1else/usr/local/sphinx/bin/indexer--CONFIG/USR/LOCAL/SPH        inx/etc/sphinx.conf--all >/dev/null 2>&1resu=$?  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! ~ ~ ~ (>_<) ~ ~ ~ \e[m ' #红色 echo-e ' \e[31m******************************************************************** \e [m ' #红色 fi return ${resu}fi}indexer_online () {if ["${sphinx_active}"-eq 0];thenecho-e ' \e[31m Sphinx Ha s been turned off \e[m ' #红色exit 1else/usr/local/sphinx/bin/indexer--config/usr/local/sphinx/etc/sphinx.conf--rotate--all >/dev/null 2>&1resu=$?  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}status () {if ["${sphinx_active}"-eq 0];thenecho-e ' \e[31m Sphinx has been t        urned off \e[m ' #红色exit 1else/usr/local/sphinx/bin/searchd--config/usr/local/sphinx/etc/sphinx.conf--status        Resu=$?  if ["${resu}"-eq 0]; Then #echo the SPHinx status OK "Echo-e ' \e[32m******************************************************************** \e[m ' #绿色 Echo-e ' \e[32m (^_^) Sphinx status ok (^_^) \e[m ' #绿色 echo-e ' \e[32m***************************************** \e[m ' #绿色 else #echo "Sphinx status Unknow" Echo-e ' \e[31m************* \e[m ' #红色 echo-e ' \e[31m!o (︶^︶) o! Sphinx Status Unknown ~ ~ ~ (>_<) ~ ~ ~ \e[m ' #红色 echo-e ' \e[31m********************************************** \e[m ' #红色 fi return ${resu}fi}case $ inrestart) Stopstart;; stop) stop;; Start) Start; Indexer_all) Indexer_all;; Indexer_online) Indexer_online;; status) status; Esacexit 0


"Combat" Sphinx start close Management script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.