From 619b9d46b91cdf0f523b3804ec9a07b0f1ba4efe Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 16 Jun 2016 22:45:28 +0000 Subject: watch: introduce watch directive 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. --- script/public-inbox-watch | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 script/public-inbox-watch (limited to 'script') 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 +# License: AGPL-3.0+ +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; +} -- cgit v1.2.3-24-ge0c7