summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-08-11 19:57:38 -0500
committerJesse Luehrs <doy@tozt.net>2012-08-11 19:58:28 -0500
commit2b1f3bb9c348c05dd43c7185c07c49a45a70de48 (patch)
treeb4e8f970ad156a203412d7cc7a89b29ab08e27d9
parent633aa3c9523ae17566b619ab68c1933cc811b7e5 (diff)
downloadconf-2b1f3bb9c348c05dd43c7185c07c49a45a70de48.tar.gz
conf-2b1f3bb9c348c05dd43c7185c07c49a45a70de48.zip
script to keep notmuch up to date
-rw-r--r--bin/watch_mail19
1 files changed, 19 insertions, 0 deletions
diff --git a/bin/watch_mail b/bin/watch_mail
new file mode 100644
index 0000000..44c4a51
--- /dev/null
+++ b/bin/watch_mail
@@ -0,0 +1,19 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use 5.014;
+
+use Linux::Inotify2;
+
+my $inotify = Linux::Inotify2->new;
+for my $dir (`find $ENV{HOME}/Maildir -name cur`) {
+ chomp $dir;
+ $inotify->watch($dir, IN_MODIFY|IN_MOVED_TO|IN_CREATE|IN_DELETE);
+}
+
+$inotify->blocking(1);
+
+while (1) {
+ my @e = $inotify->read;
+ system("notmuch new > /dev/null 2>&1");
+}