From: Don Armstrong Date: Thu, 21 Jun 2007 13:31:25 +0000 (+0100) Subject: * Lock while updating the indices in gen-indice X-Git-Tag: release/2.6.0~538^2~7 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=9fa0eb0eae9abee175066e5e6b5bc0f5d5152cd7;p=debbugs.git * Lock while updating the indices in gen-indice --- diff --git a/scripts/gen-indices.in b/scripts/gen-indices.in index 73243b8e..4097e95e 100755 --- a/scripts/gen-indices.in +++ b/scripts/gen-indices.in @@ -92,6 +92,16 @@ if (defined $ARGV[0] and $ARGV[0] eq "archive") { $suffix = "-arc"; } +if (not lockpid($config{spool_dir}.'/lock/gen-indices')) { + if ($options{quick}) { + # If this is a quick run, just exit + print STDERR "Another gen-indices is running; stopping\n" if $verbose; + exit 0; + } + print STDERR "Another gen-indices is running; stopping\n"; + exit 1; +} + # NB: The reverse index is special; it's used to clean up during updates to bugs my @indexes = ('package', 'tag', 'severity','owner','submitter-email','reverse'); my $indexes; @@ -211,3 +221,4 @@ for my $i (@indexes) { system('touch','-d',"1/1/1970 UTC + ${start_time}secs","$indexdest/by-$i$suffix.idx"); } +unlink($config{spool_dir}.'/lock/gen-indices')