help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How I am handling msmtp queues


From: Felix Dietrich
Subject: Re: How I am handling msmtp queues
Date: Fri, 11 Mar 2022 15:55:48 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Jean Louis <bugs@gnu.support> writes:

> * Felix Dietrich <felix.dietrich@sperrhaken.name> [2022-03-10 19:33]:
>> Jean Louis <bugs@gnu.support> writes:

>>> msmtp-runqueue.sh
>>> =================
>>>
>>> #!/usr/bin/env bash
>>>
>>> QUEUEDIR="$HOME/.msmtpqueue"
>>> LOCKFILE="$QUEUEDIR/.lock"
>>> MAXWAIT=120
>>>
>>> OPTIONS=$@
>>>
>>> # wait for a lock that another instance has set
>>> WAIT=0
>>> while [ -e "$LOCKFILE" -a "$WAIT" -lt "$MAXWAIT" ]; do
>>>
>>> # […]
>>>
>>> # lock the $QUEUEDIR
>>> touch "$LOCKFILE" || exit 1
>>>
>>> # […]

I think your lock file handling is not race free.  There are lock file
helpers that you may find useful.  On Debian, for example:

  $ apt-file find bin/lockfile
  lockfile-progs: /usr/bin/lockfile-check   
  lockfile-progs: /usr/bin/lockfile-create
  lockfile-progs: /usr/bin/lockfile-remove
  lockfile-progs: /usr/bin/lockfile-touch
  procmail:       /usr/bin/lockfile

>>> while [ -e "$LOCKFILE" -a "$WAIT" -lt "$MAXWAIT" ]; do

The general advice for the test commandʼs operators "-a" and "-o" is to
not use them (they have been marked obsolescent) but instead the shellʼs
operators "&&" and "||", respectively [1]:

  while [ -e "$LOCKFILE" ] && [ "$WAIT" -lt "$MAXWAIT" ]; do

> OpenSMTPD is good of course. Though it does not handle queue as well
> as Courier MTA and has some problems, it is still in development. I
> have many emails, many people, so it gives me experience with it.

What issues did you encounter with OpenSMTPD?


Footnotes:
[1]  See the note at the description for "-a" and "-o" as well as the
     section “APPLICATION USAGE” in the following document:

     https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html

-- 
Felix Dietrich



reply via email to

[Prev in Thread] Current Thread [Next in Thread]