From 3aaac414983b0f600643f1b611231fa3a4c371cf Mon Sep 17 00:00:00 2001 From: Damien LASSERRE Date: Wed, 2 Nov 2011 08:24:54 +0000 Subject: [PATCH] --- Sphinx.sh | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/Sphinx.sh b/Sphinx.sh index 36d7d5e..4159134 100755 --- a/Sphinx.sh +++ b/Sphinx.sh @@ -72,16 +72,16 @@ then echo -e "2. Past version : 0.9.9\n" ;; '--install') - #Environement for installation + if [ ! -e /dbs ];then `mkdir /dbs`; dbs="Success"; fi - #repertoire temporaire. + if [ ! -e tmp ];then `mkdir tmp`; fi if [ ! -e /dbs/sphinx ];then echo -e "/dbs/sphinx Doesn't exist !"; exit; fi if [ ! -e /dbs/sphinxlog ];then `mkdir /dbs/sphinxlog`; exit; fi if [ ! -e /usr/local/sphinx ];then `mkdir /dbs/sphinx`; exit; fi - if [ ! -e /init.d/sphinxsearch ];then `cp initscript/sphinxsearch /etc/init.d/; chmod +x /etc/init.d/sphinxsearch ;update-rc.d sphinxsearch defaults`; fi + if [ ! -e /init.d/sphinxsearch ];then `cp initscript/sphinxsearch /etc/init.d/ > /dev/null` ;`chmod +x /etc/init.d/sphinxsearch > /dev/null`; `update-rc.d sphinxsearch defaults > /dev/null`; fi if [ ! -e config/${HOSTNAME} ];then `mkdir config/${HOSTNAME}`;fi - #Check if package in directory, if you want to download manually the package + if [ ! -e sphinx-2.0.1.tar.gz ] || [ ! -e sphinx-0.9.9.tar.gz ] then if [ ! -z $2 ]; then @@ -167,6 +167,38 @@ then echo -e $VERT"The refresh as been finish ! great ! thank's damien :)"$NORMAL exit ;; + '--add') + `mkdir config/${HOSTANME}` + echo -n "Machine MASTER ? (y/n) : "; read response + `touch /usr/local/sphinx/etc/sphinx.conf`; + echo -e $ROUGE"Mode MASTER activated"$NORMAL + echo -e "Tapez 'stop' pour quiter l'invite de création des indexes" + while [ indexe != "stop\n" ]; do + echo -e " Entrez indexe : "; read indexe + if [ $response = 'y' ];then + if [ -e config/base/Master/$indexe.conf-MysqlServer ] + then + `cp config/base/Master/$indexe.conf-MysqlServer config/${HOSTNAME}/` + echo -e "Indexe $indexes as been create !"; + else + break; + fi + else + if [ -e config/base/Slave/$indexe.conf-MysqlServer ] + then + `cp config/base/Slave/$indexe.conf-MysqlServer config/${HOSTNAME}/` + echo -e "Indexe ''$indexes'' as been create !"; + else + break; + fi + fi + done; + `cat config/base/sphinx.conf > /usr/local/sphinx/etc/sphinx.conf `; + `cat config/${HOSTNAME}/*.conf-MysqlServer >> /usr/local/sphinx/etc/sphinx.conf`; + `./Sphinx --refresh` + echo -e $VERT"The installation as been finish ! great ! thank's damien :)"$NORMAL + exit + ;; *) #Default echo -e $ROUGE"[Erreur]" ${ERREURS["CMD"]} $NORMAL