On Fri, 7 Dec 2018 at 10:22, Dominic Raferd <domi...@timedicer.co.uk> wrote:

> 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,
>>
>> 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.
>

To complete this thread: because sponge does not always prevent a change in
the inode of the file to which it is writing (in this case $MBOXFILE), and
sed -i never does, I now use ed; and the rather horrible hack of restarting
incrond is not required.

Reply via email to