Hi,
I finally found some time to check your contribution.
Gianpaolo Del Matto wrote the following on 24.06.2005 15:38 :
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Lionel,
>
>Find a new version of update_sqlgrey_config attached to this message.
>I've ported the whole thing over to Perl as it is more portable
>than a bash script (eg. FreeBSD misses md5sum and it's own md5 has
>a different syntax).
>
>
I made some changes...
A problem with check_procs:
- it didn't work properly on Linux (ps -x is not a valid syntax).
- if for example you do a "vi update_sqlgrey_config" and launch it,
check_procs thinks update_sqlgrey_config is alrealy launched.
As the window for a race condition is now reduced (only move files
around after all downloads, see below), I removed check_procs completely.
Revert to original update_sqlgrey_config behaviour, specifically :
- don't download files that already match the checksum,
- don't replace any file unless all files downloaded match the checksum,
- don't print anything unless something had to be done (don't want cron
to send mails each time this script is called, a new --verbose|-v flag
overrides this).
The code for managing the temp directory is replaced. This one should be
guaranteed collision-free by use of File::Temp::tempdir, the details for
file/directory removal are handled by File::Temp ("CLEANUP => 1" in the
tempdir call).
There will be a lot of new dependencies with this script. I think I'll
provide both update_sqlgrey_config files in the future as they both have
their usage. The shell one is small and only needs md5sum, the perl one
is more clean and probably easier to port.
You'll find the result attached.
Lionel.
|