At 09:33 AM 11/08/02 -0800, Greg Fenton wrote:
>Find attached the shell script (SH/BASH) that I have written and been
>using for building my swish-e database. I send it for consideration to
>be added to the swish-e project and/or downloads page.
I like the idea of writing the index to a temporary directory, I thought
about having swish do that automatically, but it's not very platform
specific. Even the rename swish currently uses doesn't work on Windows
(have to first delete the existing file before renaming).
The locking is overkill, as why would you run the script more than once?
(BTW - is there a way to create a lock in a shell script that isn't a race
condition? Maybe one could run a perl command to use sysopen with O_CREAT
and look at the exit status.)
I've been trying to lead a more simple life lately (my old P133 case now
holds flowers). What features do you lose if you just do this in a crontab?
0 2 * * * swish-e -c /path/to/config -v0
Seems like that's less error prone than a 348 line script.
Swish should only do the mv if the index is written correctly so it's not a
problem to index a live site. It's not atomic like the directory move
(because it's moving two files), but I'd bet the odds of getting caught
with another processing opening unmatched index files right in the middle
of the move is low.
I'm all for using -v0 and only receiving email when there's a problem.
Daily emails saying the site was indexed successfully seem pointless and
can make you miss when a problem really does happen.
Received on Fri Nov 8 19:19:21 2002