about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-01-11 23:55:27 +0000
committerEric Wong <e@80x24.org>2015-01-11 23:56:05 +0000
commit5a5b285567528d52860cfd971ff808c75158155e (patch)
tree8734b33ae1fb99b91225cbd52dc4dde9665ee3c4
parentda9af2c78e69afa36f90e82dc6dd3a2a378944c7 (diff)
downloadpublic-inbox-5a5b285567528d52860cfd971ff808c75158155e.tar.gz
This should alleviate fears of interrupting the process.
-rwxr-xr-xscripts/import_slrnspool6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/import_slrnspool b/scripts/import_slrnspool
index 1f25eff2..d95836d6 100755
--- a/scripts/import_slrnspool
+++ b/scripts/import_slrnspool
@@ -14,6 +14,10 @@ use PublicInbox::Config;
 use Email::Filter;
 use Email::LocalDelivery;
 sub usage { "Usage:\n".join('',grep(/\t/, `head -n 10 $0`)) }
+my $exit = 0;
+my $sighandler = sub { $exit = 1 };
+$SIG{INT} = $sighandler;
+$SIG{TERM} = $sighandler;
 my $spool = shift @ARGV or die usage();
 my $recipient = $ENV{ORIGINAL_RECIPIENT};
 defined $recipient or die usage();
@@ -45,7 +49,7 @@ my $ok;
 my $max_gap = 10000;
 my $max = $n + $max_gap;
 
-for (; $n < $max; $n++) {
+for (; $exit == 0 && $n < $max; $n++) {
         my $fn = "$spool/$n";
         print STDERR $fn, "\n";
         open(my $fh, '<', $fn) or next;