#!/bin/bash # # enable at boot time with # # echo reprocess-maildir-inotify # su - MAILUSER ~MAILUSER/bin/reprocess-maildir-inotify & # # ps auxfw | grep reprocess # maildir=$HOME/Maildir/.RE-PROCESS function notify { inotifywait -m -e close_write -e close_nowrite -e close \ $maildir/cur \ $maildir/new \ $maildir/tmp \ | while read line; do date >> $HOME/reprocess-maildir-inotify.log echo $line >> $HOME/reprocess-maildir-inotify.log # just in case there are many operations # we would not like to reprocess right after the first one sleep 1 $HOME/bin/reprocess-maildir $HOME/Maildir/.RE-PROCESS/ >> $HOME/reprocess-maildir-inotify.log 2>&1 break done } while true; do notify done