On Fri, 7 Dec 2018 at 09:15, Matus UHLAR - fantomas <uh...@fantomas.sk>
wrote:

> On 06.12.18 15:45, Dominic Raferd wrote:
> >I am using incrond to monitor an mbox file (in /var/mail) for changes,
>
> hmmm, why?
> maybe there's other way to implement your requirement
>

I think I have it working now. The problem was not postfix (of course), it
was that I was modifying the mbox file using
postlock $MBOXFILE sed -if $SCRIPTFILE $MBOXFILE
which in fact replaces it, I am now using:
postlock $MBOXFILE /bin/bash -c "sed -f $SCRIPTFILE $MBOXFILE|sponge
$MBOXFILE" # not sure if bash subshell is necessary?
and also comparing the inode before and after - if the inode changes (which
is not normally the case) then I restart incrond.

The use case is my home-grown quarantining system. Mail server periodically
emails me about quarantined emails - I can reply to these emails using
short codes, this reply is placed by postfix in the monitored $MBOXFILE.
When $MBOXFILE changes, incrond triggers a script which looks at the latest
email in it and interprets it to take the necessary actions i.e. removing
unwanted mails from quarantine, releasing wanted ones, whitelisting sender
etc.

Reply via email to