nmh-workers
[Top] [All Lists]

Re: Synchronization Problem

2020-07-24 12:07:37
fetchmail runs off a deamon and deposits emails which are in fine nmh format
but do not have a numeric names. So I run this script:
[...]
But after the scan is complete and before I do the rmm, the script might
have put a new message in +inbox, which rmm would remove.

There aren't _wonderful_ solutions, because this is a higher-level problem;
other programs can change the state of your inbox between commands.
Unless you want to do something like Kevin Cosgrove suggested, this is
fundamental to your design.  You could do some higher-level locking
where you prevent your script from running while you read your inbox.

It does occur to me you could use something like the previous-sequence
to preserve the selected message between "scan" and "rmm".  I don't know
if the refile command modifies the previous-sequence in inbox, but if it
does not you could do:

scan +inbox
rmm prevseq:last

(I'd want to test that thoroughly before I committed to using it, though).

--Ken

<Prev in Thread] Current Thread [Next in Thread>