Update config files

This commit is contained in:
Michael RICOIS 2014-02-10 09:07:13 +00:00
parent 4834d09b10
commit 8dd7fc655d
19 changed files with 118 additions and 249 deletions

View File

@ -2,8 +2,6 @@
PATH_BIN=/usr/local/sphinx/bin PATH_BIN=/usr/local/sphinx/bin
PATH_LOG=/dbs/sphinxlog PATH_LOG=/dbs/sphinxlog
DATE=`date '+%Y-%m-%d %H-%M-%S'` echo "DEBUT de l'indexation ==== $(date +%H:%M:%S)" >> $PATH_LOG/indexer.log
$PATH_BIN/indexer --rotate act >> $PATH_LOG/indexer.log
echo "DEBUT de l'indexation ==== $(date +%H:%M:%S)" >> $PATH_LOG/indexerAct-$(date +%F).log echo "FIN ===== $(date +%H:%M:%S)" >> $PATH_LOG/indexer.log
$PATH_BIN/indexer --rotate act act_phx >> $PATH_LOG/indexerAct-$(date +%F).log
echo "FIN ===== $(date +%H:%M:%S)" >> $PATH_LOG/indexerAct-$(date +%F).log

View File

@ -1,13 +1,13 @@
#!/bin/bash #!/bin/bash
PATH_BIN=/usr/local/sphinx/bin PATH_BIN=/usr/local/sphinx/bin
PATH_LOG=/dbs/sphinxlog PATH_LOG=/dbs/sphinxlog
PATH_SQL=/home/scripts/indexer/sql
DATE=`date '+%Y-%m-%d %H-%M-%S'`
echo "DEBUT de l'indexation ==== $(date +%H:%M:%S)" >> $PATH_LOG/indexerDiri-$(date +%F).log echo "DEBUT de l'indexation ==== $(date +%H:%M:%S)" >> $PATH_LOG/indexer.log
# nombre de lignes dans la table etab # nombre de lignes dans la table etab
output=$(mysql -h192.168.3.30 -usphinx -pindexer jo < sql/countDiri.sql) output=$(mysql -h192.168.3.30 -usphinx -pindexer jo < $PATH_SQL/countDiri.sql)
for line in "$output"; do for line in "$output"; do
etab="$line" etab="$line"
done done
@ -15,7 +15,7 @@ done
etab=$(echo $etab|sed -e "s/^[etab ]*//g"||sed -e "s/[ ]*$//g") etab=$(echo $etab|sed -e "s/^[etab ]*//g"||sed -e "s/[ ]*$//g")
# nombre de lignes dans la table diri_tmp # nombre de lignes dans la table diri_tmp
output=$(mysql -h192.168.3.30 -usphinx -pindexer jo < sql/countDiri_tmp.sql) output=$(mysql -h192.168.3.30 -usphinx -pindexer jo < $PATH_SQL/countDiri_tmp.sql)
for line in "$output"; do for line in "$output"; do
etab_tmp="$line" etab_tmp="$line"
done done
@ -23,15 +23,18 @@ done
etab_tmp=$(echo $etab_tmp|sed -e "s/^[etab_tmp ]*//g"||sed -e "s/[ ]*$//g") etab_tmp=$(echo $etab_tmp|sed -e "s/^[etab_tmp ]*//g"||sed -e "s/[ ]*$//g")
# Comparaison du nombre de lignes entre etab (ancien) et etab_tmp (nouveau) # Comparaison du nombre de lignes entre etab (ancien) et etab_tmp (nouveau)
if test $etab_tmp -gt $etab; then if [ -z "$etab" ]; then
echo "Il y a $etab_tmp lignes dans la nouvelle table dirigeants ($etab lignes dans l'ancienne)" >> $PATH_LOG/indexerDiri-$(date +%F).log echo "etab = null"
$PATH_BIN/indexer --rotate dir dir_phx >> $PATH_LOG/indexerDiri-$(date +%F).log elif [ -z "$etab_tmp" ]; then
echo "Sphinx - termine : $(date +%H:%M:%S)" >> $PATH_LOG/indexerDiri-$(date +%F).log echo "etab_tmp = null"
mysql -f -usphinx -h192.168.3.30 -pindexer jo < sql/finIndexationDiri.sql >> $PATH_LOG/indexerDiri-$(date +%F).log elif [ $etab_tmp -gt $etab ]; then
echo "Il y a $etab_tmp lignes dans la nouvelle table dirigeants ($etab lignes dans l'ancienne)" >> $PATH_LOG/indexer.log
$PATH_BIN/indexer --config /etc/sphinxsearch/sphinx.conf --rotate dir dir_phx >> $PATH_LOG/indexer.log
echo "Sphinx - termine : $(date +%H:%M:%S)" >> $PATH_LOG/indexer.log
mysql -f -usphinx -h192.168.3.30 -pindexer jo < $PATH_SQL/finIndexationDiri.sql >> $PATH_LOG/indexer.log
else else
# Il y a plus de lignes dans l'ancienne table dirigeants ==> On ne fait rien # Il y a plus de lignes dans l'ancienne table dirigeants ==> On ne fait rien
echo "Il n'y a pas assez de lignes dans la nouvelle table dirigeants ($etab_tmp / $etab) !" >> $PATH_LOG/indexerDiri-$(date +%F).log echo "Il n'y a pas assez de lignes dans la nouvelle table dirigeants ($etab_tmp / $etab) !" >> $PATH_LOG/indexer.log
exit
fi fi
echo "FIN ===== $(date +%H:%M:%S)" >> $PATH_LOG/indexerDiri-$(date +%F).log echo "FIN ===== $(date +%H:%M:%S)" >> $PATH_LOG/indexer.log

View File

@ -1,13 +1,12 @@
#!/bin/bash #!/bin/bash
PATH_BIN=/usr/local/sphinx/bin PATH_BIN=/usr/local/sphinx/bin
PATH_LOG=/dbs/sphinxlog PATH_LOG=/dbs/sphinxlog
PATH_SQL=/home/scripts/indexer/sql
DATE=`date '+%Y-%m-%d %H-%M-%S'` echo "DEBUT de l'indexation ==== $(date +%H:%M:%S)" >> $PATH_LOG/indexer.log
echo "DEBUT de l'indexation ==== $(date +%H:%M:%S)" >> $PATH_LOG/indexerEtab-$(date +%F).log
# nombre de lignes dans la table etab # nombre de lignes dans la table etab
output=$(mysql -h192.168.3.30 -usphinx -pindexer jo < sql/countEtab.sql) output=$(mysql -h192.168.3.30 -usphinx -pindexer jo < $PATH_SQL/countEtab.sql)
for line in "$output"; do for line in "$output"; do
etab="$line" etab="$line"
done done
@ -17,7 +16,7 @@ etab=$(echo $etab|sed -e "s/^[etab ]*//g"||sed -e "s/[ ]*$//g")
#etab=$(echo $etab| gawk '{print + 0}') #etab=$(echo $etab| gawk '{print + 0}')
# nombre de lignes dans la table etab_tmp # nombre de lignes dans la table etab_tmp
output=$(mysql -h192.168.3.30 -usphinx -pindexer jo < sql/countEtab_tmp.sql) output=$(mysql -h192.168.3.30 -usphinx -pindexer jo < $PATH_SQL/countEtab_tmp.sql)
for line in "$output"; do for line in "$output"; do
etab_tmp="$line" etab_tmp="$line"
done done
@ -27,16 +26,18 @@ etab_tmp=$(echo $etab_tmp|sed -e "s/^[etab_tmp ]*//g"||sed -e "s/[ ]*$//g")
#etab_tmp=$(echo $etab_tmp| gawk '{print + 0}') #etab_tmp=$(echo $etab_tmp| gawk '{print + 0}')
# Comparaison du nombre de lignes entre etab (ancien) et etab_tmp (nouveau) # Comparaison du nombre de lignes entre etab (ancien) et etab_tmp (nouveau)
if test $etab_tmp -gt $etab; then if [ -z "$etab" ]; then
echo "Il y a $etab_tmp lignes dans la nouvelle table etablissement ($etab lignes dans l'ancienne)" >> $PATH_LOG/indexerEtab-$(date +%F).log echo "etab = null"
# $PATH_BIN/indexer --rotate --all >> $PATH_LOG/indexer-$(date +%F).log elif [ -z "$etab_tmp" ]; then
$PATH_BIN/indexer --rotate ent ent_mns ent_phx >> $PATH_LOG/indexerEtab-$(date +%F).log echo "etab_tmp = null"
echo "Sphinx - terminé : $(date +%H:%M:%S)" >> $PATH_LOG/indexerEtab-$(date +%F).log elif [ $etab_tmp -gt $etab ]; then
mysql -f -usphinx -h192.168.3.30 -pindexer jo < sql/finIndexationEtab.sql >> $PATH_LOG/indexerEtab-$(date +%F).log echo "Il y a $etab_tmp lignes dans la nouvelle table etablissement ($etab lignes dans l'ancienne)" >> $PATH_LOG/indexer.log
$PATH_BIN/indexer --config /etc/sphinxsearch/sphinx.conf --rotate ent ent_phx >> $PATH_LOG/indexer.log
echo "Sphinx - terminé : $(date +%H:%M:%S)" >> $PATH_LOG/indexer.log
mysql -f -usphinx -h192.168.3.30 -pindexer jo < $PATH_SQL/finIndexationEtab.sql >> $PATH_LOG/indexer.log
else else
# Il y a plus de lignes dans l'ancienne table etablissements ==> On ne fait rien # Il y a plus de lignes dans l'ancienne table etablissements ==> On ne fait rien
echo "Il n'y a pas assez de lignes dans la nouvelle table etablissement ($etab_tmp / $etab) !" >> $PATH_LOG/indexerEtab-$(date +%F).log echo "Il n'y a pas assez de lignes dans la nouvelle table etablissement ($etab_tmp / $etab) !" >> $PATH_LOG/indexer.log
exit
fi fi
echo "FIN ===== $(date +%H:%M:%S)" >> $PATH_LOG/indexerEtab-$(date +%F).log echo "FIN ===== $(date +%H:%M:%S)" >> $PATH_LOG/indexer.log

36
indexer/test.sh Normal file
View File

@ -0,0 +1,36 @@
#!/bin/bash
PATH_BIN=/usr/local/sphinx/bin
PATH_LOG=/dbs/sphinxlog
PATH_SQL=/home/scripts/indexer/sql
# nombre de lignes dans la table etab
output=$(mysql -h192.168.3.30 -usphinx -pindexer jo < $PATH_SQL/countEtab.sql)
for line in "$output"; do
etab="$line"
done
# Suppression fin de ligne
etab=$(echo $etab|sed -e "s/^[etab ]*//g"||sed -e "s/[ ]*$//g")
# Cast de la variable au cas ou
#etab=$(echo $etab| gawk '{print + 0}')
# nombre de lignes dans la table etab_tmp
output=$(mysql -h192.168.3.30 -usphinx -pindexer jo < $PATH_SQL/countEtab_tmp.sql)
for line in "$output"; do
etab_tmp="$line"
done
# Suppression fin de ligne
etab_tmp=$(echo $etab_tmp|sed -e "s/^[etab_tmp ]*//g"||sed -e "s/[ ]*$//g")
# Cast de la variable au cas ou
#etab_tmp=$(echo $etab_tmp| gawk '{print + 0}')
# Comparaison du nombre de lignes entre etab (ancien) et etab_tmp (nouveau)
if [ -z "$etab" ]; then
echo "etab = null"
elif [ -z "$etab_tmp" ]; then
echo "etab_tmp = null"
elif [ $etab_tmp -gt $etab ]; then
echo "Il y a $etab_tmp lignes dans la nouvelle table etablissement ($etab lignes dans l'ancienne)"
else
# Il y a plus de lignes dans l'ancienne table etablissements ==> On ne fait rien
echo "Il n'y a pas assez de lignes dans la nouvelle table etablissement ($etab_tmp / $etab) !"
fi

View File

@ -1,147 +0,0 @@
#! /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 /etc/sphinxsearch/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

View File

@ -1,12 +0,0 @@
/dbs/sphinxlog/query.log /dbs/sphinxlog/searchd.log {
missingok
notifempty
weekly
rotate 5
compress
delaycompress
create 640 root root
postrotate
killall -SIGUSR1 searchd
endscript
}

View File

@ -1,10 +0,0 @@
#
# Settings for the sphinxsearch searchd daemon
# Please read /usr/share/doc/sphinxsearch/README.Debian for details.
#
# Should sphinxsearch run automatically on startup? (default: no)
# Before doing this you might want to modify /etc/sphinxsearch/sphinx.conf
# so that it works for you.
START=yes

View File

@ -1 +0,0 @@
/lib/init/upstart-job

View File

@ -1,34 +0,0 @@
# SphinxSearch Service
description "SphinxSearch Daemon"
author "Andrey Aksyonoff <shodan@sphinxsearch.com>"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
respawn
respawn limit 10 35
# The default of 5 seconds is too low if we have rt indices and have to flush them
kill timeout 30
env DEFAULTFILE="/etc/default/sphinxsearch"
pre-start script
if [ -f "$DEFAULTFILE" ]; then
. "$DEFAULTFILE"
fi
if [ "z$START" != "zyes" ]; then
stop
logger "To enable sphinxsearch, edit /etc/default/sphinxsearch and set START=yes"
exit 0
fi
if [ ! -f /etc/sphinxsearch/sphinx.conf ]; then
logger "Please create an /etc/sphinxsearch/sphinx.conf configuration file."
logger "Templates are in the /etc/sphinxsearch/ directory."
exit 0
fi
end script
exec /usr/local/sphinx/bin/searchd --nodetach --config /etc/sphinxsearch/sphinx.conf

View File

@ -1,12 +0,0 @@
/dbs/sphinxlog/query.log /dbs/sphinxlog/searchd.log {
missingok
notifempty
weekly
rotate 5
compress
delaycompress
create 640 root root
postrotate
killall -SIGUSR1 searchd
endscript
}

View File

@ -43,3 +43,22 @@ index dir
U+F4->o, U+F5->o, U+F6->o, U+F8->o, U+F9->u, U+FA->u,U+FB->u, U+FC->u, \ U+F4->o, U+F5->o, U+F6->o, U+F8->o, U+F9->u, U+FA->u,U+FB->u, U+FC->u, \
U+FD->y, U+FF->y, U+0152->U+0153, U+0153 U+FD->y, U+FF->y, U+0152->U+0153, U+0153
} }
index dir_phx
{
source = dir
path = /dbs/sphinx/dir_phx
docinfo = extern
charset_type = utf-8
charset_table = 0..9, A..Z->a..z, a..z, \
U+23, U+25, U+26, U+2B, U+3D, U+40, \
U+C0->a, U+C1->a, U+C2->a, U+C3->a, U+C4->a, U+C5->a, U+C6->a, U+C7->c, \
U+C8->e, U+C8->e, U+C9->e, U+CA->e, U+CB->e, U+CC->i, U+CD->i, U+CE->i, \
U+CF->i, U+D0->d, U+D1->n, U+D2->o, U+D3->o, U+D4->o, U+D5->o, U+D6->o, \
U+D8->o, U+D9->u, U+DA->u, U+DB->u, U+DC->u, U+DD->y, U+E0->a, U+E1->a, \
U+E2->a, U+E3->a, U+E4->a, U+E5->a, U+E7->c, U+E8->e, U+E9->e, U+EA->e, \
U+EB->e, U+EC->i, U+ED->i, U+EE->i, U+EF->i, U+F1->n, U+F2->o, U+F3->o, \
U+F4->o, U+F5->o, U+F6->o, U+F8->o, U+F9->u, U+FA->u,U+FB->u, U+FC->u, \
U+FD->y, U+FF->y, U+0152->U+0153, U+0153
min_stemming_len = 4
}

View File

@ -42,3 +42,22 @@ index dir
U+F4->o, U+F5->o, U+F6->o, U+F8->o, U+F9->u, U+FA->u,U+FB->u, U+FC->u, \ U+F4->o, U+F5->o, U+F6->o, U+F8->o, U+F9->u, U+FA->u,U+FB->u, U+FC->u, \
U+FD->y, U+FF->y, U+0152->U+0153, U+0153 U+FD->y, U+FF->y, U+0152->U+0153, U+0153
} }
index dir_phx
{
source = dir
path = /dbs/sphinx/dir_phx
docinfo = extern
charset_type = utf-8
charset_table = 0..9, A..Z->a..z, a..z, \
U+23, U+25, U+26, U+2B, U+3D, U+40, \
U+C0->a, U+C1->a, U+C2->a, U+C3->a, U+C4->a, U+C5->a, U+C6->a, U+C7->c, \
U+C8->e, U+C8->e, U+C9->e, U+CA->e, U+CB->e, U+CC->i, U+CD->i, U+CE->i, \
U+CF->i, U+D0->d, U+D1->n, U+D2->o, U+D3->o, U+D4->o, U+D5->o, U+D6->o, \
U+D8->o, U+D9->u, U+DA->u, U+DB->u, U+DC->u, U+DD->y, U+E0->a, U+E1->a, \
U+E2->a, U+E3->a, U+E4->a, U+E5->a, U+E7->c, U+E8->e, U+E9->e, U+EA->e, \
U+EB->e, U+EC->i, U+ED->i, U+EE->i, U+EF->i, U+F1->n, U+F2->o, U+F3->o, \
U+F4->o, U+F5->o, U+F6->o, U+F8->o, U+F9->u, U+FA->u,U+FB->u, U+FC->u, \
U+FD->y, U+FF->y, U+0152->U+0153, U+0153
min_stemming_len = 4
}

View File

@ -1,3 +1,4 @@
source histo source histo
{ {
type = mysql type = mysql

View File

@ -71,7 +71,7 @@ if ($argv[1]=='config')
//Initscript //Initscript
if ($argv[2]=='etc') { if ($argv[2]=='etc') {
$version = $argv[3]; $version = $argv[3];
exec("cp -vRi scripts/build/config/$version/etc/* /etc/"); exec("cp -vRi scripts/build/$version/etc/* /etc/");
exit; exit;
} }

View File

@ -0,0 +1,8 @@
/dbs/sphinxlog/indexer.log {
missingok
notifempty
weekly
rotate 5
compress
delaycompress
}