This commit is contained in:
parent
dab19de250
commit
4ed2a13a1c
223
Sphinx.sh
Executable file
223
Sphinx.sh
Executable file
@ -0,0 +1,223 @@
|
||||
#!/bin/bash
|
||||
source parametres.sh
|
||||
source function.sh
|
||||
|
||||
allVersion=("2.0.1" "0.9.9")
|
||||
source='files/description.list'
|
||||
|
||||
`cat $source`
|
||||
echo ' ____ __ ____ __ '
|
||||
echo '/\ _`\ /\ \ __ /\ _`\ /\ \__ '
|
||||
echo '\ \,\L\_\ _____\ \ \___ /\_\ ___ __ _ \ \ \L\_\ __ ___ __ _ __ __ \ \ ,_\ ___ _ __ '
|
||||
echo ' \/_\__ \ /\ __` \ \ _ `\/\ \ / _ `\ /\ \/ \ \ \ \L_L / __`\/ _ `\ / __`\/\` __\/ __`\ \ \ \/ / __`\/\` __\'
|
||||
echo ' /\ \L\ \ \ \L\ \ \ \ \ \ \ \/\ \/\ \\/> </ \ \ \/, \/\ __//\ \/\ \/\ __/\ \ \//\ \L\.\_\ \ \_/\ \L\ \ \ \/ '
|
||||
echo ' \ `\____\ \ ,__/\ \_\ \_\ \_\ \_\ \_\/\_/\_\ \ \____/\ \____\ \_\ \_\ \____\\ \_\\ \__/.\_\\ \__\ \____/\ \_\ '
|
||||
echo ' \/_____/\ \ \/ \/_/\/_/\/_/\/_/\/_/\//\/_/ \/___/ \/____/\/_/\/_/\/____/ \/_/ \/__/\/_/ \/__/\/___/ \/_/ '
|
||||
echo ' \ \_\ '
|
||||
echo ' \/_/ '
|
||||
|
||||
if [ `id -u` = 0 ] #Need Root or Sudo
|
||||
then
|
||||
commande=('--configure' '--install' '--all')
|
||||
for i; do
|
||||
case $i in
|
||||
'--delete')
|
||||
`rm -r indexeConf source sphinx-* wget* libste* *~ 2> /dev/null`
|
||||
echo -e "- Clean directory"
|
||||
exit
|
||||
;;
|
||||
'--version')
|
||||
echo -e "1. Last version : 2.0.1"
|
||||
echo -e "2. Past version : 0.9.9\n"
|
||||
;;
|
||||
'--install')
|
||||
#Environement for installation
|
||||
if [ ! -f sphinx-error-log.log ];then `touch sphinx-error-log.log &`; log="Success"; fi
|
||||
if [ ! -e indexeConf ];then `mkdir indexeConf`; indexeConf="Success"; fi
|
||||
`touch indexeConf/sphinx.conf`
|
||||
sphinxconf="Success"
|
||||
if [ ! -e source ];then `mkdir source`; source="Success"; fi
|
||||
if [ ! -e /dbs ];then `mkdir /dbs`; dbs="Success"; fi
|
||||
if [ ! -e /dbs/sphinx ];then `mkdir /dbs/sphinx`; sphinx="Success"; fi
|
||||
if [ ! -e /dbs/sphinxlog ];then `mkdir /dbs/sphinxlog`; sphinxlog="Success"; 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
|
||||
if [ $2 == "2.0.1" ]; then
|
||||
version="$2-beta"
|
||||
elif [ $2 == "0.9.9" ]; then
|
||||
version="$2"
|
||||
else
|
||||
echo -e $ROUGE"[Erreur]: This version not exist !"$NORMAL
|
||||
exit
|
||||
fi
|
||||
echo -e $CYAN"Download Sphinx-$version..."$NORMAL
|
||||
`wget -b http://sphinxsearch.com/files/sphinx-$version.tar.gz >/dev/null`
|
||||
loadIndication `(ps -C wget -o pid=)`
|
||||
`rm wget-log*`
|
||||
else
|
||||
echo -e $ROUGE"[Erreur]: Please specifie version, exemple 2.0.1 or 0.9.9"$NORMAL
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
`tar -z -xf sphinx-$version.tar.gz -C source `
|
||||
`rm sphinx-$version.tar.gz*`
|
||||
echo -e " - Extract files..."
|
||||
echo -e " - Complited"
|
||||
#If libstemmer not installed in source/
|
||||
if [ -e libstemmer_c.tgz ]
|
||||
then
|
||||
echo -e $CYAN"Extract file from libstemmer_c..."$NORMAL
|
||||
`cd source/sphinx-$version ; tar -zxf libstemmer_c.tgz`
|
||||
echo -e " - Complited"
|
||||
else
|
||||
echo -e $CYAN"Download and Configure libstemmer..."$NORMAL
|
||||
`cd source/sphinx-$version ; wget -b http://snowball.tartarus.org/dist/libstemmer_c.tgz > /dev/null`
|
||||
loadIndication `(ps -C wget -o pid=)`
|
||||
fi
|
||||
echo -e "- Extract files..."
|
||||
`cd source/sphinx-$version ; tar -zxf libstemmer_c.tgz`
|
||||
echo -e "- Complited"
|
||||
`cd source/sphinx-$version ; rm libstemmer_c.tgz`
|
||||
libstemmer="100%"
|
||||
echo ""
|
||||
echo -e $CYAN"Configuration progress..."$ROUGE
|
||||
`cd source/sphinx-$version ; sh configure --with-libstemmer --prefix=/usr/local/sphinx 1> /dev/null `
|
||||
echo -e $NORMAL"- Complited"
|
||||
echo -e $NORMAL
|
||||
echo -e $CYAN"Compilation progress..."$ROUGE
|
||||
if [ $version != "2.0.1-beta" ];then `cd source/sphinx-$version ; make ` ;fi
|
||||
#`cd source/sphinx-$version/ ; make install 1> /dev/null`
|
||||
echo -e $NORMAL" - Complited"
|
||||
echo ""
|
||||
echo -e $CYAN"Visualisation"$NORMAL
|
||||
echo -e "---------------------------------------------------------------------------------------"
|
||||
echo -e "1. Directory : source " $VERT $source $NORMAL
|
||||
echo -e "2. Directory : indexeConf " $VERT $indexeConf $NORMAL
|
||||
echo -e "3. Directory : /dbs " $VERT $dbs $NORMAL
|
||||
echo -e "4. Directory : /dbs/sphinx " $VERT $sphinx $NORMAL
|
||||
echo -e "5. Directory : /dbs/sphinxlog " $VERT $sphinxlog $NORMAL
|
||||
echo -e "6. File : sphinx-error-log.log " $VERT $log $NORMAL
|
||||
echo -e "7. File : indexeConf/sphinx.conf " $VERT $sphinxconf $NORMAL
|
||||
if [ ! -z $2 ]; then
|
||||
if [ $2 == "2.0.1" ] || [ $2 = "0.9.9" ] || [ $2 = "0.9.5" ]; then
|
||||
echo -e "8. Archive : sphinx-$2-beta.tar.gz "$VERT"100%"$NORMAL
|
||||
else
|
||||
echo -e "8. Archive : Version : $2 not exist " $ROUGE "Failed" $NORMAL
|
||||
fi
|
||||
fi
|
||||
echo -e "9. Archive : libstemmer_c.tgz " $VERT $libstemmer $NORMAL
|
||||
echo -e "10. Compilation : /source/sphinx-$version/src/libstemmer_c "$VERT"Compiled" $NORMAL
|
||||
echo -e "11. Compilation : /source/sphinx-$version/src/ "$VERT"Complited" $NORMAL
|
||||
|
||||
echo -e $VERT"Directory and Files as beens creates\n" $NORMAL
|
||||
echo -n "Do you want to configure Index ? (y/n) : "; read response
|
||||
if [ $response = 'y' ]
|
||||
then
|
||||
echo -n "Please Enter name of index file (act ent etc...) : "
|
||||
read response
|
||||
for index in ${response[@]}
|
||||
do
|
||||
`cp files/generic.sphinx.conf indexeConf/$index.sphinx.conf`
|
||||
`sed -e "s/xindex/$index/g" -i indexeConf/$index.sphinx.conf`
|
||||
echo -e " - Written data in $index.sphinx.conf"
|
||||
`cat indexeConf/$index.sphinx.conf >> indexeConf/sphinx.conf`
|
||||
echo -e $VERT"File $index as been create"$NORMAL
|
||||
done
|
||||
`cat files/config.sphinx >> indexeConf/sphinx.conf`
|
||||
`cp indexeConf/sphinx.conf .`
|
||||
fi
|
||||
echo -e $VERT"The installation as been finish ! great ! thank's damien :)"$NORMAL
|
||||
exit
|
||||
;;
|
||||
'--add')
|
||||
#Add a index
|
||||
if [ ! -e indexeConf/$2.sphinx.conf ]
|
||||
then
|
||||
echo -e $CYAN"Adding index progress..."$NORMAL
|
||||
`cp files/generic.sphinx.conf indexeConf/$2.sphinx.conf`
|
||||
`sed -e "s/xindex/$2/g" -i indexeConf/$2.sphinx.conf`
|
||||
`cat indexeConf/sphinx.conf > tmp`
|
||||
`cat indexeConf/$2.sphinx.conf > indexeConf/sphinx.conf`
|
||||
`cat tmp >> indexeConf/sphinx.conf`
|
||||
echo -e " - Check if this index exist"
|
||||
echo -e " - Create file in indexeConf/$2.sphinx.conf"
|
||||
echo -e " - Adding index in sphinx.conf"
|
||||
echo -e $VERT"Index $2 as been create"$NORMAL
|
||||
`rm tmp`
|
||||
`cp indexeConf/sphinx.conf .`
|
||||
exit
|
||||
else
|
||||
echo -e $ROUGE"[Erreur]: This index already exist !"$NORMAL
|
||||
exit
|
||||
fi
|
||||
echo -e $VERT"Configuration started" $NORMAL
|
||||
;;
|
||||
'--remove')
|
||||
#Run all action.
|
||||
if [ -e indexeConf/$2.sphinx.conf ]
|
||||
then
|
||||
echo -e $CYAN"Remove progress..."$NORMAL
|
||||
`rm indexeConf/$2.sphinx.conf`
|
||||
`cat indexeConf/* > indexeConf/sphinx.conf`
|
||||
`cat files/config.sphinx >> indexeConf/sphinx.conf`
|
||||
echo -e " - Delete file indexeConf/$2.sphinx.conf"
|
||||
echo -e " - Delete data in sphinx.conf"
|
||||
echo -e $VERT"Index $2 as been delete"$NORMAL
|
||||
`rm tmp > /dev/null`
|
||||
`cp indexeConf/sphinx.conf .`
|
||||
exit
|
||||
else
|
||||
echo -e $ROUGE"[Erreur]: This index: $2 not exist ! impossible to remove !"$NORMAL
|
||||
exit
|
||||
fi
|
||||
;;
|
||||
'--updateQuery')
|
||||
if [ ! -z $2 ]
|
||||
then
|
||||
echo -e $CYAN"Update Query progress..."$NORMAL
|
||||
query=`cat $3`
|
||||
`sed -e "s/#xqueryx/$query/g" -i indexeConf/$2.sphinx.conf`
|
||||
`cat indexeConf/sphinx.conf > tmp`
|
||||
`cat indexeConf/$2.sphinx.conf > indexeConf/sphinx.conf`
|
||||
`cat tmp >> indexeConf/sphinx.conf`
|
||||
echo -e " - Query as been update in index $2"
|
||||
echo -e " - Refreshing sphinx.conf"
|
||||
echo -e $VERT"Operion successfull"$NORMAL
|
||||
`rm tmp > /dev/null`
|
||||
`cp indexeConf/sphinx.conf .`
|
||||
exit;
|
||||
fi
|
||||
;;
|
||||
'--refresh')
|
||||
if [ -d indexeConf ]
|
||||
then
|
||||
`rm indexeConf/*~ 2> /dev/null`
|
||||
echo -e $CYAN"Refreshing progress..."$NORMAL
|
||||
directory=`ls indexeConf`
|
||||
for index in ${directory[*]}
|
||||
do
|
||||
echo " - Refreshing : "$index
|
||||
done
|
||||
`cat indexeConf/*.sphinx.conf > sphinx.conf`
|
||||
`cat files/config.sphinx >> sphinx.conf`
|
||||
echo -e $VERT"Refreshing as been finish"$NORMAL
|
||||
exit
|
||||
else
|
||||
echo -e $ROUGE"[Erreur]: nothing has refresh !"$NORMAL
|
||||
exit
|
||||
fi
|
||||
|
||||
;;
|
||||
*)
|
||||
#Default
|
||||
echo -e $ROUGE"[Erreur]" ${ERREURS["CMD"]} $NORMAL
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
done
|
||||
echo -e $ROUGE"[Erreur]" ${ERREURS["NOCMD"]} $NORMAL
|
||||
else
|
||||
echo -e $ROUGE"[Erreur]" ${ERREURS["CHMOD"]} $NORMAL
|
||||
fi
|
77
files/config.sphinx
Normal file
77
files/config.sphinx
Normal file
@ -0,0 +1,77 @@
|
||||
|
||||
#############################################################################
|
||||
## indexer settings
|
||||
#############################################################################
|
||||
|
||||
indexer
|
||||
{
|
||||
# memory limit, in bytes, kiloytes (16384K) or megabytes (256M)
|
||||
# optional, default is 32M, max is 2047M, recommended is 256M to 1024M
|
||||
mem_limit = 256
|
||||
|
||||
# maximum IO calls per second (for I/O throttling)
|
||||
# optional, default is 0 (unlimited)
|
||||
#
|
||||
# max_iops = 40
|
||||
|
||||
|
||||
# maximum IO call size, bytes (for I/O throttling)
|
||||
# optional, default is 0 (unlimited)
|
||||
#
|
||||
# max_iosize = 1048576
|
||||
}
|
||||
|
||||
#############################################################################
|
||||
## searchd settings
|
||||
#############################################################################
|
||||
|
||||
searchd
|
||||
{
|
||||
# IP address to bind on
|
||||
# optional, default is 0.0.0.0 (ie. listen on all interfaces)
|
||||
#
|
||||
# address = 127.0.0.1
|
||||
# address = 192.168.0.1
|
||||
|
||||
|
||||
# searchd TCP port number
|
||||
# mandatory, default is 3312
|
||||
listen = 3312
|
||||
|
||||
# log file, searchd run info is logged here
|
||||
# optional, default is 'searchd.log'
|
||||
log = /dbs/sphinxlog/searchd.log
|
||||
|
||||
# query log file, all search queries are logged here
|
||||
# optional, default is empty (do not log queries)
|
||||
query_log = /dbs/sphinxlog/query.log
|
||||
|
||||
# client read timeout, seconds
|
||||
# optional, default is 5
|
||||
read_timeout = 5
|
||||
|
||||
# maximum amount of children to fork (concurrent searches to run)
|
||||
# optional, default is 0 (unlimited)
|
||||
max_children = 30
|
||||
|
||||
# PID file, searchd process ID file name
|
||||
# mandatory
|
||||
pid_file = /var/log/searchd.pid
|
||||
|
||||
# max amount of matches the daemon ever keeps in RAM, per-index
|
||||
# WARNING, THERE'S ALSO PER-QUERY LIMIT, SEE SetLimits() API CALL
|
||||
# default is 1000 (just like Google)
|
||||
max_matches = 1000
|
||||
|
||||
# seamless rotate, prevents rotate stalls if precaching huge datasets
|
||||
# optional, default is 1
|
||||
seamless_rotate = 0
|
||||
|
||||
# whether to forcibly preopen all indexes on startup
|
||||
# optional, default is 0 (do not preopen)
|
||||
preopen_indexes = 0
|
||||
|
||||
# whether to unlink .old index copies on succesful rotation.
|
||||
# optional, default is 1 (do unlink)
|
||||
unlink_old = 1
|
||||
}
|
10
files/description.list
Normal file
10
files/description.list
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
____ __ ____ __
|
||||
/\ _`\ /\ \ __ /\ _`\ /\ \__
|
||||
\ \,\L\_\ _____\ \ \___ /\_\ ___ __ _ \ \ \L\_\ __ ___ __ _ __ __ \ \ ,_\ ___ _ __
|
||||
\/_\__ \ /\ '__`\ \ _ `\/\ \ /' _ `\ /\ \/'\ \ \ \L_L /'__`\/' _ `\ /'__`\/\`'__\/'__`\ \ \ \/ / __`\/\`'__\
|
||||
/\ \L\ \ \ \L\ \ \ \ \ \ \ \/\ \/\ \\/> </ \ \ \/, \/\ __//\ \/\ \/\ __/\ \ \//\ \L\.\_\ \ \_/\ \L\ \ \ \/
|
||||
\ `\____\ \ ,__/\ \_\ \_\ \_\ \_\ \_\/\_/\_\ \ \____/\ \____\ \_\ \_\ \____\\ \_\\ \__/.\_\\ \__\ \____/\ \_\
|
||||
\/_____/\ \ \/ \/_/\/_/\/_/\/_/\/_/\//\/_/ \/___/ \/____/\/_/\/_/\/____/ \/_/ \/__/\/_/ \/__/\/___/ \/_/
|
||||
\ \_\
|
||||
\/_/
|
53
files/generic.sphinx.conf
Executable file
53
files/generic.sphinx.conf
Executable file
@ -0,0 +1,53 @@
|
||||
|
||||
|
||||
source source_xindex
|
||||
{
|
||||
type = mysql
|
||||
sql_host =
|
||||
sql_user =
|
||||
sql_pass =
|
||||
sql_db =
|
||||
sql_query_pre =
|
||||
sql_query =
|
||||
}
|
||||
|
||||
index xindex
|
||||
{
|
||||
source = source_xindex
|
||||
path = /dbs/sphinx/xindex
|
||||
docinfo = extern
|
||||
wordforms = /usr/local/sphinx/etc/wordforms.txt
|
||||
abreviations = /usr/local/sphinx/etc/abreviations.txt
|
||||
ispell_aff = /usr/local/sphinx/etc/francais.aff
|
||||
charset_type = sbcs
|
||||
charset_table = 0..9, A..Z->a..z, a..z, \
|
||||
U+23, U+25, U+26, U+2B, U+3D, U+40, \
|
||||
U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF
|
||||
}
|
||||
|
||||
index xindex_mns
|
||||
{
|
||||
source = source_xindex
|
||||
path = /dbs/sphinx/xindex_mns
|
||||
docinfo = extern
|
||||
wordforms = /usr/local/sphinx/etc/wordforms.txt
|
||||
abreviations = /usr/local/sphinx/etc/abreviations.txt
|
||||
non_significatifs = /usr/local/sphinx/etc/mots-non-significatifs.txt
|
||||
charset_type = sbcs
|
||||
charset_table = 0..9, A..Z->a..z, a..z, \
|
||||
U+23, U+25, U+26, U+2B, U+3D, U+40, \
|
||||
U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF
|
||||
}
|
||||
|
||||
index xindex_phx
|
||||
{
|
||||
source = source_xindex
|
||||
path = /dbs/sphinx/xindex_phx
|
||||
docinfo = extern
|
||||
morphology = libstemmer_francais
|
||||
wordforms = /usr/local/sphinx/etc/wordforms.txt
|
||||
charset_type = sbcs
|
||||
charset_table = 0..9, A..Z->a..z, a..z, \
|
||||
U+23, U+25, U+26, U+2B, U+3D, U+40, \
|
||||
U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF
|
||||
}
|
147
files/sphinxsearch
Normal file
147
files/sphinxsearch
Normal file
@ -0,0 +1,147 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
|
||||
# Modified for Debian
|
||||
# by Ian Murdock <imurdock@gnu.ai.mit.edu>.
|
||||
# Further changes by Javier Fernandez-Sanguino <jfs@debian.org>
|
||||
# Modified for sphinx by Radu Spineanu <radu@debian.org>
|
||||
#
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: sphinxsearch
|
||||
# Required-Start: $local_fs $remote_fs $syslog $network $time
|
||||
# Required-Stop: $local_fs $remote_fs $syslog $network
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Fast standalone full-text SQL search engine
|
||||
### END INIT INFO
|
||||
|
||||
PREFIX=/usr/local/sphinx
|
||||
DATA=/dbs/sphinx
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
DAEMON=$PREFIX/bin/searchd
|
||||
NAME=sphinx
|
||||
DESC=sphinx
|
||||
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
PIDFILE=/var/log/searchd.pid
|
||||
DODTIME=1 # Time to wait for the server to die, in seconds
|
||||
# If this value is set too low you might not
|
||||
# let some servers to die gracefully and
|
||||
# 'restart' will not work
|
||||
|
||||
# Include sphinx defaults if available
|
||||
if [ -f /etc/default/sphinx ] ; then
|
||||
. /etc/default/sphinx
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
running_pid()
|
||||
{
|
||||
# Check if a given process pid's cmdline matches a given name
|
||||
pid=$1
|
||||
name=$2
|
||||
[ -z "$pid" ] && return 1
|
||||
[ ! -d /proc/$pid ] && return 1
|
||||
cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1`
|
||||
# Is this the expected child?
|
||||
[ "$cmd" != "$name" ] && return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
running()
|
||||
{
|
||||
# Check if the process is running looking at /proc
|
||||
# (works for all users)
|
||||
|
||||
# No pidfile, probably no daemon present
|
||||
[ ! -f "$PIDFILE" ] && return 1
|
||||
# Obtain the pid and check it against the binary name
|
||||
pid=`cat $PIDFILE`
|
||||
running_pid $pid $DAEMON || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
force_stop() {
|
||||
# Forcefully kill the process
|
||||
[ ! -f "$PIDFILE" ] && return
|
||||
if running ; then
|
||||
kill -15 $pid
|
||||
# Is it really dead?
|
||||
[ -n "$DODTIME" ] && sleep "$DODTIME"s
|
||||
if running ; then
|
||||
kill -9 $pid
|
||||
[ -n "$DODTIME" ] && sleep "$DODTIME"s
|
||||
if running ; then
|
||||
echo "Cannot kill $LABEL (pid=$pid)!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
rm -f $PIDFILE
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting $DESC: "
|
||||
|
||||
# Check if we have the configuration file
|
||||
if [ ! -f /usr/local/sphinx/etc/sphinx.conf ]; then
|
||||
echo "Please create an /usr/local/sphinx/sphinx.conf configuration file."
|
||||
echo "Templates are in the directory."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
start-stop-daemon --start --exec ${DAEMON}
|
||||
if running ; then
|
||||
echo "$NAME."
|
||||
else
|
||||
echo " ERROR."
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
echo -n "Stopping $DESC: "
|
||||
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE \
|
||||
--exec $DAEMON
|
||||
echo "$NAME."
|
||||
;;
|
||||
force-stop)
|
||||
echo -n "Forcefully stopping $DESC: "
|
||||
force_stop
|
||||
if ! running ; then
|
||||
echo "$NAME."
|
||||
else
|
||||
echo " ERROR."
|
||||
fi
|
||||
;;
|
||||
restart)
|
||||
echo -n "Restarting $DESC: "
|
||||
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE \
|
||||
--exec $DAEMON
|
||||
[ -n "$DODTIME" ] && sleep $DODTIME
|
||||
start-stop-daemon --start --exec ${DAEMON}
|
||||
echo "$NAME."
|
||||
;;
|
||||
|
||||
status)
|
||||
echo -n "$LABEL is "
|
||||
if running ; then
|
||||
echo "running"
|
||||
else
|
||||
echo " not running."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
N=/etc/init.d/$NAME
|
||||
# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
|
||||
echo "Usage: $N {start|stop|restart|force-reload|status|force-stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
21
function.sh
Normal file
21
function.sh
Normal file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
function loadIndication() {
|
||||
while [ -d "/proc/$1" ]
|
||||
do #Current PID in /proc |
|
||||
echo -en "Loading... /\033[1G"; sleep .07
|
||||
echo -en "Loading... -\033[1G"; sleep .07
|
||||
echo -en "Loading... / \033[1G"; sleep .07
|
||||
echo -en "Loading... |\033[1G"; sleep .07
|
||||
done
|
||||
}
|
||||
|
||||
function loadIndicationFile() {
|
||||
while [ ! -e $1 ]
|
||||
do
|
||||
echo -en "$VERT Load... /\033[1G"; sleep .07
|
||||
echo -en "$ROUGE Load... -\033[1G"; sleep .07
|
||||
echo -en "$CYAN Load... / \033[1G"; sleep .07
|
||||
echo -en "$NORMAL Load... |\033[1G"; sleep .07
|
||||
done
|
||||
}
|
32
parametres.sh
Normal file
32
parametres.sh
Normal file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
declare -A ERREURS
|
||||
declare -A ASTUCES
|
||||
|
||||
#Color declaration
|
||||
ROUGE="\\033[1;31m"
|
||||
NORMAL="\\033[0;39m"
|
||||
CYAN="\\033[1;36m"
|
||||
VERT="\\033[1;32m"
|
||||
|
||||
BOLD="\\033[1m"
|
||||
UNDERLINE="\\033[4m"
|
||||
TEXTNONE="\\033[0m"
|
||||
|
||||
#Var
|
||||
dir="Exist"
|
||||
log="Exist"
|
||||
dbs="Exist"
|
||||
sphinx="Exist"
|
||||
sphinxlog="Exist"
|
||||
|
||||
#Tab of erreurs and astuces
|
||||
ERREURS=(
|
||||
["CHMOD"]="Execute the script with SUDO or in ROOT"
|
||||
["DIRECTORY"]="Directory not create"
|
||||
["FILE"]=
|
||||
["CMD"]="This command not exist"
|
||||
["NOCMD"]="Please enter options")
|
||||
|
||||
ASTUCES=(
|
||||
["CREATE"]="Sphinx --create (prepare l'environement)")
|
233
sphinx.conf
Normal file
233
sphinx.conf
Normal file
@ -0,0 +1,233 @@
|
||||
|
||||
|
||||
source source_act
|
||||
{
|
||||
type = mysql
|
||||
sql_host =
|
||||
sql_user =
|
||||
sql_pass =
|
||||
sql_db =
|
||||
sql_query_pre =
|
||||
sql_query = la query !
|
||||
}
|
||||
|
||||
index act
|
||||
{
|
||||
source = source_act
|
||||
path = /dbs/sphinx/act
|
||||
docinfo = extern
|
||||
wordforms = /usr/local/sphinx/etc/wordforms.txt
|
||||
abreviations = /usr/local/sphinx/etc/abreviations.txt
|
||||
ispell_aff = /usr/local/sphinx/etc/francais.aff
|
||||
charset_type = sbcs
|
||||
charset_table = 0..9, A..Z->a..z, a..z, \
|
||||
U+23, U+25, U+26, U+2B, U+3D, U+40, \
|
||||
U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF
|
||||
}
|
||||
|
||||
index act_mns
|
||||
{
|
||||
source = source_act
|
||||
path = /dbs/sphinx/act_mns
|
||||
docinfo = extern
|
||||
wordforms = /usr/local/sphinx/etc/wordforms.txt
|
||||
abreviations = /usr/local/sphinx/etc/abreviations.txt
|
||||
non_significatifs = /usr/local/sphinx/etc/mots-non-significatifs.txt
|
||||
charset_type = sbcs
|
||||
charset_table = 0..9, A..Z->a..z, a..z, \
|
||||
U+23, U+25, U+26, U+2B, U+3D, U+40, \
|
||||
U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF
|
||||
}
|
||||
|
||||
index act_phx
|
||||
{
|
||||
source = source_act
|
||||
path = /dbs/sphinx/act_phx
|
||||
docinfo = extern
|
||||
morphology = libstemmer_francais
|
||||
wordforms = /usr/local/sphinx/etc/wordforms.txt
|
||||
charset_type = sbcs
|
||||
charset_table = 0..9, A..Z->a..z, a..z, \
|
||||
U+23, U+25, U+26, U+2B, U+3D, U+40, \
|
||||
U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF
|
||||
}
|
||||
|
||||
source source_dir
|
||||
{
|
||||
type = mysql
|
||||
sql_host =
|
||||
sql_user =
|
||||
sql_pass =
|
||||
sql_db =
|
||||
sql_query_pre =
|
||||
sql_query =
|
||||
}
|
||||
|
||||
index dir
|
||||
{
|
||||
source = source_dir
|
||||
path = /dbs/sphinx/dir
|
||||
docinfo = extern
|
||||
wordforms = /usr/local/sphinx/etc/wordforms.txt
|
||||
abreviations = /usr/local/sphinx/etc/abreviations.txt
|
||||
ispell_aff = /usr/local/sphinx/etc/francais.aff
|
||||
charset_type = sbcs
|
||||
charset_table = 0..9, A..Z->a..z, a..z, \
|
||||
U+23, U+25, U+26, U+2B, U+3D, U+40, \
|
||||
U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF
|
||||
}
|
||||
|
||||
index dir_mns
|
||||
{
|
||||
source = source_dir
|
||||
path = /dbs/sphinx/dir_mns
|
||||
docinfo = extern
|
||||
wordforms = /usr/local/sphinx/etc/wordforms.txt
|
||||
abreviations = /usr/local/sphinx/etc/abreviations.txt
|
||||
non_significatifs = /usr/local/sphinx/etc/mots-non-significatifs.txt
|
||||
charset_type = sbcs
|
||||
charset_table = 0..9, A..Z->a..z, a..z, \
|
||||
U+23, U+25, U+26, U+2B, U+3D, U+40, \
|
||||
U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF
|
||||
}
|
||||
|
||||
index dir_phx
|
||||
{
|
||||
source = source_dir
|
||||
path = /dbs/sphinx/dir_phx
|
||||
docinfo = extern
|
||||
morphology = libstemmer_francais
|
||||
wordforms = /usr/local/sphinx/etc/wordforms.txt
|
||||
charset_type = sbcs
|
||||
charset_table = 0..9, A..Z->a..z, a..z, \
|
||||
U+23, U+25, U+26, U+2B, U+3D, U+40, \
|
||||
U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF
|
||||
}
|
||||
|
||||
source source_ent
|
||||
{
|
||||
type = mysql
|
||||
sql_host =
|
||||
sql_user =
|
||||
sql_pass =
|
||||
sql_db =
|
||||
sql_query_pre =
|
||||
sql_query =
|
||||
}
|
||||
|
||||
index ent
|
||||
{
|
||||
source = source_ent
|
||||
path = /dbs/sphinx/ent
|
||||
docinfo = extern
|
||||
wordforms = /usr/local/sphinx/etc/wordforms.txt
|
||||
abreviations = /usr/local/sphinx/etc/abreviations.txt
|
||||
ispell_aff = /usr/local/sphinx/etc/francais.aff
|
||||
charset_type = sbcs
|
||||
charset_table = 0..9, A..Z->a..z, a..z, \
|
||||
U+23, U+25, U+26, U+2B, U+3D, U+40, \
|
||||
U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF
|
||||
}
|
||||
|
||||
index ent_mns
|
||||
{
|
||||
source = source_ent
|
||||
path = /dbs/sphinx/ent_mns
|
||||
docinfo = extern
|
||||
wordforms = /usr/local/sphinx/etc/wordforms.txt
|
||||
abreviations = /usr/local/sphinx/etc/abreviations.txt
|
||||
non_significatifs = /usr/local/sphinx/etc/mots-non-significatifs.txt
|
||||
charset_type = sbcs
|
||||
charset_table = 0..9, A..Z->a..z, a..z, \
|
||||
U+23, U+25, U+26, U+2B, U+3D, U+40, \
|
||||
U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF
|
||||
}
|
||||
|
||||
index ent_phx
|
||||
{
|
||||
source = source_ent
|
||||
path = /dbs/sphinx/ent_phx
|
||||
docinfo = extern
|
||||
morphology = libstemmer_francais
|
||||
wordforms = /usr/local/sphinx/etc/wordforms.txt
|
||||
charset_type = sbcs
|
||||
charset_table = 0..9, A..Z->a..z, a..z, \
|
||||
U+23, U+25, U+26, U+2B, U+3D, U+40, \
|
||||
U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF
|
||||
}
|
||||
#############################################################################
|
||||
## indexer settings
|
||||
#############################################################################
|
||||
|
||||
indexer
|
||||
{
|
||||
# memory limit, in bytes, kiloytes (16384K) or megabytes (256M)
|
||||
# optional, default is 32M, max is 2047M, recommended is 256M to 1024M
|
||||
mem_limit = 256
|
||||
|
||||
# maximum IO calls per second (for I/O throttling)
|
||||
# optional, default is 0 (unlimited)
|
||||
#
|
||||
# max_iops = 40
|
||||
|
||||
|
||||
# maximum IO call size, bytes (for I/O throttling)
|
||||
# optional, default is 0 (unlimited)
|
||||
#
|
||||
# max_iosize = 1048576
|
||||
}
|
||||
|
||||
#############################################################################
|
||||
## searchd settings
|
||||
#############################################################################
|
||||
|
||||
searchd
|
||||
{
|
||||
# IP address to bind on
|
||||
# optional, default is 0.0.0.0 (ie. listen on all interfaces)
|
||||
#
|
||||
# address = 127.0.0.1
|
||||
# address = 192.168.0.1
|
||||
|
||||
|
||||
# searchd TCP port number
|
||||
# mandatory, default is 3312
|
||||
listen = 3312
|
||||
|
||||
# log file, searchd run info is logged here
|
||||
# optional, default is 'searchd.log'
|
||||
log = /dbs/sphinxlog/searchd.log
|
||||
|
||||
# query log file, all search queries are logged here
|
||||
# optional, default is empty (do not log queries)
|
||||
query_log = /dbs/sphinxlog/query.log
|
||||
|
||||
# client read timeout, seconds
|
||||
# optional, default is 5
|
||||
read_timeout = 5
|
||||
|
||||
# maximum amount of children to fork (concurrent searches to run)
|
||||
# optional, default is 0 (unlimited)
|
||||
max_children = 30
|
||||
|
||||
# PID file, searchd process ID file name
|
||||
# mandatory
|
||||
pid_file = /var/log/searchd.pid
|
||||
|
||||
# max amount of matches the daemon ever keeps in RAM, per-index
|
||||
# WARNING, THERE'S ALSO PER-QUERY LIMIT, SEE SetLimits() API CALL
|
||||
# default is 1000 (just like Google)
|
||||
max_matches = 1000
|
||||
|
||||
# seamless rotate, prevents rotate stalls if precaching huge datasets
|
||||
# optional, default is 1
|
||||
seamless_rotate = 0
|
||||
|
||||
# whether to forcibly preopen all indexes on startup
|
||||
# optional, default is 0 (do not preopen)
|
||||
preopen_indexes = 0
|
||||
|
||||
# whether to unlink .old index copies on succesful rotation.
|
||||
# optional, default is 1 (do unlink)
|
||||
unlink_old = 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user