Re: [htdig] Non-blocking updates?

David Robley (
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 <> 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 at the end.
> --
> -Geoff Hutchison
> Williams Students Online

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
if [ "$1" = "-v" ]; then

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

# -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"" $DBDIR"db.docdb"
mv $DBDIR"" $DBDIR""
mv $DBDIR"" $DBDIR""
mv $DBDIR"" $DBDIR"db.wordlist"
mv $DBDIR"" $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 ]
    /web/webdocs/htdig/bin/htfuzzy $verbose endings

# 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 ]
    /web/webdocs/htdig/bin/htfuzzy $verbose synonyms

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


David Robley

WEBMASTER | Phone +61 8 8374 0970 RESEARCH CENTRE FOR INJURY STUDIES | AusEinet | Flinders University, ADELAIDE, SOUTH AUSTRALIA Visit the PHP mirror at

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

------------------------------------ To unsubscribe from the htdig mailing list, send a message to 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