[Practice] sphinx starts to close the management script and sphinx script

Source: Internet
Author: User

[Practice] sphinx starts to close the management script and sphinx script

#! /Bin/sh #/usr/local/sphinx/bin/# ocpyang@126.comsphinx _ pidfile =/usr/local/sphfile/var/log/searchd. pidif [-e "$ {sphinx_pidfile}"]; thensphinx_active = 1 # runing # echo $ {sphinx_active} elsesphinx_active = 0 # close # echo $ {sphinx_active} fistop () {if ["$ {sphinx_active}"-eq 0]; thenecho-e '\ e [31 m SPHINX Has been turned off \ e [m' # Red exit 1 else/usr/local/sphinx/bin/searchd -- config/usr/local /sphinx/etc/sphi Nx. conf -- stop>/dev/null 2> & 1 resu = $? If ["$ {resu}"-eq 0]; then echo-e '\ e [32 m ****************************** * *********************************** \ e [m' # Green echo-e '\ e [32 m (1__^) sph1_stop SUCESS (^_^) \ e [m' # Green echo-e '\ e [32 m ************************ **************************************** * *** \ e [m' # Green else echo-e '\ e [31 m ******************* **************************************** * ******** \ e [m' # Red echo-e '\ e [31 m! O (too many) o! Sphsf-stop FAIL! ~~~~ (>_< )~~~~ \ E [m' # Red echo-e '\ e [31 m ************************ **************************************** * *** \ e [m' # Red fireturn $ {resu} fi} start () {if ["$ {sphinx_active}"-eq 1]; thenecho-e '\ e [31 m SPHINX Is already running \ e [m' # Red exit 1 else/usr/local/sphinx/bin/searchd -- config/usr/local/ sphtasks/etc/sphtasks. conf>/dev/null 2> & 1 resu =$? If ["$ {resu}"-eq 0]; then echo-e '\ e [32 m ****************************** * *********************************** \ e [m' # Green echo-e '\ e [32 m (1__^) sph1_start SUCESS (^_^) \ e [m' # Green echo-e '\ e [32 m ************************ **************************************** * *** \ e [m' # Green else echo-e '\ e [31 m ******************* **************************************** * ******** \ e [m' # Red echo-e '\ e [31 m! O (too many) o! Sph1_start FAIL! ~~~~ (>_< )~~~~ \ E [m' # Red echo-e '\ e [31 m ************************ **************************************** * *** \ e [m' # Red fireturn $ {resu} fi} indexer_all () {if ["$ {sphinx_active}"-eq 0]; thenecho-e '\ e [31 m SPHINX Has been turned off \ e [m' # Red exit 1 else/usr/local/sphinx/bin/indexer -- config/usr/local /sphinx/etc/sphinx. conf -- all>/dev/null 2> & 1 resu = $? If ["$ {resu}"-eq 0]; then echo-e '\ e [32 m ****************************** * *********************************** \ e [m' # Green echo-e '\ e [32 m (1__^) sphsf-indexer_all SUCESS (pai_^) \ e [m' # Green echo-e '\ e [32 m ************************ **************************************** * *** \ e [m' # Green else echo-e '\ e [31 m ******************* **************************************** * ******** \ e [m' # Red echo-e '\ e [31 m! O (too many) o! Sphsf-indexer_all FAIL! ~~~~ (>_< )~~~~ \ E [m' # Red echo-e '\ e [31 m ************************ **************************************** * *** \ e [m' # Red fi return $ {resu} fi} indexer_online () {if ["$ {sphinx_active}"-eq 0]; thenecho-e '\ e [31 m SPHINX Has been turned off \ e [m' # Red exit 1 else/usr/local/sphinx/bin/indexer -- config/usr/local /sphinx/etc/sphinx. conf -- rotate -- all>/dev/null 2> & 1 resu = $? If ["$ {resu}"-eq 0]; then echo-e '\ e [32 m ****************************** * *********************************** \ e [m' # Green echo-e '\ e [32 m (1__^) sphsf-indexer_online SUCESS (pai_^) \ e [m' # Green echo-e '\ e [32 m ************************ **************************************** * *** \ e [m' # Green else echo-e '\ e [31 m ******************* **************************************** * ******** \ e [m' # Red echo-e '\ e [31 m! O (too many) o! Sphsf-indexer_online FAIL! ~~~~ (>_< )~~~~ \ E [m' # Red echo-e '\ e [31 m ************************ **************************************** * *** \ e [m' # Red fi return $ {resu} fi} status () {if ["$ {sphinx_active}"-eq 0]; thenecho-e '\ e [31 m SPHINX Has been turned off \ e [m' # Red exit 1 else/usr/local/sphinx/bin/searchd -- config/usr/local /sphinx/etc/sphinx. conf -- status resu = $? If ["$ {resu}"-eq 0]; then # echo "sphinx status OK" echo-e '\ e [32 m *********************** **************************************** * *** \ e [m' # Green echo-e '\ e [32 m (1__^) sph1_status OK (pai_^) \ e [m' # Green echo-e '\ e [32 m ************************ **************************************** * *** \ e [m' # Green else # echo "sphinx status unknow" echo-e '\ e [31 m ************ **************************************** * *************** \ E [m' # Red echo-e '\ e [31 m! O (too many) o! Sph1_status unknown ~~~~ (>_< )~~~~ \ E [m' # Red echo-e '\ e [31 m ************************ **************************************** * *** \ e [m' # Red fi return $ {resu} fi} case $1 inrestart) stopstart; stop) stop; start) start; indexer_all) indexer_all; indexer_online) indexer_online; status) status; esacexit 0


 

Related Article

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.