Indexation des news (messages et message-ID pour remonter aux rfrences).
By Benoit. darcs-hash:20041122194846-41617-3f5cadf6a732e397235c480a0056683f3593a724.gz
This commit is contained in:
parent
a5cf65a5b7
commit
a533f3712d
1 changed files with 37 additions and 0 deletions
37
index_news.sh
Executable file
37
index_news.sh
Executable file
|
@ -0,0 +1,37 @@
|
|||
#! /bin/sh
|
||||
# index-news : Cree les index des messages de news
|
||||
# par Benoit
|
||||
|
||||
# Repertoire des news
|
||||
Rep_News=/var/spool/news/articles/crans/
|
||||
|
||||
# Repertoire d'indexage
|
||||
Rep_Ind=/var/local/search_news/index/crans.
|
||||
|
||||
# Repertoire d'id-xage
|
||||
Rep_Id=/var/local/search_news/mid/crans.
|
||||
|
||||
# Indexage des articles
|
||||
for forum in $(find $Rep_News -type d -mindepth 1 -printf '%P \n') ; do
|
||||
if (($(du -S $Rep_News$forum --max-depth=0 | awk '{print $1}') )) ; then
|
||||
index=($Rep_Ind$(echo $forum | tr "/" "."))
|
||||
nice -10 /usr/bin/index++ -v0 -i $index -r -mFrom -mSubject -mMessage-ID -e 'mail:*' $Rep_News$forum
|
||||
|
||||
# Indexage des Id
|
||||
id=($Rep_Id$(echo $forum | tr "/" "."))
|
||||
number=$(tail -n 1 $id | awk '{print $1}')
|
||||
fichier=$Rep_News$forum/$number
|
||||
if test -f $fichier ; then
|
||||
for article in $(find $Rep_News$forum -type f -maxdepth 1 -newer $fichier -printf '%P \n') ; do
|
||||
mid=$(grep "Message-ID: " $Rep_News$forum/$article | awk '{print $2}')
|
||||
$(echo $article $mid >> $id )
|
||||
done
|
||||
else # si le dernier message avant le dernier id-xage est annule ou modere :
|
||||
# on est bourrin : on re-indexe l'ensemble
|
||||
for article in $(find $Rep_News$forum -type f -maxdepth 1 -printf '%P \n') ; do
|
||||
mid=$(grep "Message-ID: " $Rep_News$forum/$article | awk '{print $2}')
|
||||
$(echo $article $mid >> $id )
|
||||
done
|
||||
fi
|
||||
fi
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue