* [PATCH 0/4] misc import_slrnspool improvements
@ 2015-01-12 2:30 6% Eric Wong
2015-01-12 2:30 7% ` [PATCH 2/4] import_slrnspool: graceful exit for interruptibility Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2015-01-12 2:30 UTC (permalink / raw)
To: meta
Eric Wong (4):
import_slrnspool: make filtering optional
import_slrnspool: graceful exit for interruptibility
import_slrnspool: load private config key
import_slrnspool: fork a process for each message
scripts/import_slrnspool | 79 ++++++++++++++++++++++++++++++++++--------------
1 file changed, 57 insertions(+), 22 deletions(-)
^ permalink raw reply [relevance 6%]
* [PATCH 2/4] import_slrnspool: graceful exit for interruptibility
2015-01-12 2:30 6% [PATCH 0/4] misc import_slrnspool improvements Eric Wong
@ 2015-01-12 2:30 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2015-01-12 2:30 UTC (permalink / raw)
To: meta
This should alleviate fears of interrupting the process.
---
scripts/import_slrnspool | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/scripts/import_slrnspool b/scripts/import_slrnspool
index 1f25eff..d95836d 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;
--
EW
^ permalink raw reply related [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2015-01-12 2:30 6% [PATCH 0/4] misc import_slrnspool improvements Eric Wong
2015-01-12 2:30 7% ` [PATCH 2/4] import_slrnspool: graceful exit for interruptibility Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).