Re: [htdig] Non-blocking updates?


David Robley (huntsman@www.nisu.flinders.edu.au)
Thu, 8 Jul 1999 10:13:48 +0930 (CST)


On 7 Jul, Geoff Hutchison wrote:
>
> peter karlsson wrote:
>> Hmmm, would it be possible to copy the old database, update it, and then
>> moving it over the old files when it's done? Has anyone done this?
>
> Yes. See <http://www.htdig.org/files/contrib/rundig.sh> for an example.
> (It's my script so I'm a bit biased ;-) It doesn't actually doesn't copy
> beforehand, it just leaves around a copy (of the db.docs.db) at the end.
>
> --
> -Geoff Hutchison
> Williams Students Online
> http://wso.williams.edu/

My modification of Geoff's version may be a bit closer to what you want:

#! /bin/sh

#
# updatedig
#
# This is a script to update the search database for ht://Dig.
#
# Set the database directory
DBDIR=/web/webdocs/htdig/db/
if [ "$1" = "-v" ]; then
    verbose=-v
fi

# Copy the current databases to .work
cp $DBDIR"db.docdb" $DBDIR"db.docdb.work"
cp $DBDIR"db.docs" $DBDIR"db.docs.work"
cp $DBDIR"db.docs.index" $DBDIR"db.docsindex.work"
cp $DBDIR"db.wordlist" $DBDIR"db.wordlist.work"
cp $DBDIR"db.words.db" $DBDIR"db.words.db.work"

# -a: run using alternate work files so search can still be done during index run
# -t: create an ASCII version of document database in doc_list as specified
# in the config file
# -s: print stats after completion
/web/webdocs/htdig/bin/htdig -a -t $verbose -s
/web/webdocs/htdig/bin/htmerge -a $verbose -s
/web/webdocs/htdig/bin/htnotify $verbose

# Because the -a switch creates alternate work files, but doesn't seem to move
# them into the correct place, we will do it here.
mv $DBDIR"db.docdb.work" $DBDIR"db.docdb"
mv $DBDIR"db.docs.work" $DBDIR"db.docs"
mv $DBDIR"db.docs.index.work" $DBDIR"db.docs.index"
mv $DBDIR"db.wordlist.work" $DBDIR"db.wordlist"
mv $DBDIR"db.words.db.work" $DBDIR"db.words.db"

# Only create the endings database if it doesn't already exist.
# This database is static, so even if pages change, this database will not
# need to be rebuilt.
#
if [ ! -f /web/webdocs/htdig/common/word2root.db ]
then
    /web/webdocs/htdig/bin/htfuzzy $verbose endings
fi

# This next needs to be run if synonyms are added/modified/removed
# Guess the best way would be to delete synonyms.gdbm before
# running this script??

if [ ! -f /web/webdocs/htdig/common/synonyms.db ]
then
    /web/webdocs/htdig/bin/htfuzzy $verbose synonyms
fi

You'll have to mangle it a bit to suit your needs and configuration...

Cheers

-- 
David Robley

WEBMASTER | Phone +61 8 8374 0970 RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA Visit the PHP mirror at http://au.php.net:81/

<<<<<<<<<<<<< WARNING * END OF TEXT * STOP READING HERE >>>>>>>>>>>>>>

------------------------------------ To unsubscribe from the htdig mailing list, send a message to htdig@htdig.org containing the single word "unsubscribe" in the SUBJECT of the message.



This archive was generated by hypermail 2.0b3 on Wed Jul 07 1999 - 16:41:17 PDT