2 # Copyright (C) 2016-2019 all contributors <meta@public-inbox.org>
3 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
6 use PublicInbox::WatchMaildir;
7 use PublicInbox::Config;
8 my ($config, $watch_md);
10 $config = PublicInbox::Config->new;
11 $watch_md->quit if $watch_md;
12 $watch_md = PublicInbox::WatchMaildir->new($config);
16 my $scan = sub { $watch_md->trigger_scan('full') if $watch_md };
19 $SIG{ALRM} = sub { $SIG{ALRM} = 'DEFAULT'; $scan->() };
20 $SIG{QUIT} = $SIG{TERM} = $SIG{INT} = sub {
21 $watch_md->quit if $watch_md;
25 $watch_md->watch while ($watch_md);