about summary refs log tree commit homepage
path: root/script
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-06-16 22:45:28 +0000
committerEric Wong <e@80x24.org>2016-06-17 00:27:44 +0000
commit619b9d46b91cdf0f523b3804ec9a07b0f1ba4efe (patch)
treea6304a15544ea3ee90dfe7cf2e6169aab2bc16b1 /script
parent160a6d5672fef64c174c8d79c07851eaadf6d0e6 (diff)
downloadpublic-inbox-619b9d46b91cdf0f523b3804ec9a07b0f1ba4efe.tar.gz
This will allow users to run importers off existing mail
accounts where they may not have access to run -mda.
Currently, we only support Maildirs, but IMAP ought to be
doable.
Diffstat (limited to 'script')
-rwxr-xr-xscript/public-inbox-watch16
1 files changed, 16 insertions, 0 deletions
diff --git a/script/public-inbox-watch b/script/public-inbox-watch
new file mode 100755
index 00000000..42ae55ae
--- /dev/null
+++ b/script/public-inbox-watch
@@ -0,0 +1,16 @@
+#!/usr/bin/perl -w
+# Copyright (C) 2016 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+use strict;
+use warnings;
+use PublicInbox::WatchMaildir;
+use PublicInbox::Config;
+my $config = PublicInbox::Config->new;
+my $watch_md = PublicInbox::WatchMaildir->new($config);
+if ($watch_md) {
+        my $scan = sub { $watch_md->scan };
+        $SIG{USR1} = $scan;
+        $SIG{ALRM} = sub { $SIG{ALRM} = 'DEFAULT'; $scan->() };
+        alarm(1);
+        $watch_md->watch;
+}