about summary refs log tree commit homepage
path: root/script
diff options
context:
space:
mode:
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;
+}