From 9fa0eb0eae9abee175066e5e6b5bc0f5d5152cd7 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Thu, 21 Jun 2007 14:31:25 +0100 Subject: [PATCH] * Lock while updating the indices in gen-indice --- scripts/gen-indices.in | 11 +++++++++++ 1 file changed, 11 insertions(+) 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') -- 2.39.5