]> git.donarmstrong.com Git - debbugs.git/commitdiff
* Lock while updating the indices in gen-indice
authorDon Armstrong <don@donarmstrong.com>
Thu, 21 Jun 2007 13:31:25 +0000 (14:31 +0100)
committerDon Armstrong <don@donarmstrong.com>
Thu, 21 Jun 2007 13:31:25 +0000 (14:31 +0100)
scripts/gen-indices.in

index 73243b8e5119b0d6cc9ee3a6432c36d88abe6157..4097e95e03c555cc46b8600e41cea070cf697288 100755 (executable)
@@ -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')