all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Felix Dietrich <felix.dietrich@sperrhaken.name>
To: help-gnu-emacs@gnu.org
Subject: Re: How I am handling msmtp queues
Date: Fri, 11 Mar 2022 15:55:48 +0100	[thread overview]
Message-ID: <87ilskedxn.fsf@sperrhaken.name> (raw)
In-Reply-To: <YipIsFrhdDkyzXb+@protected.localdomain> (Jean Louis's message of "Thu, 10 Mar 2022 21:51:28 +0300")

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	other threads:[~2022-03-11 14:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10  6:23 How I am handling msmtp queues Jean Louis
2022-03-10 16:21 ` Felix Dietrich
2022-03-10 18:51   ` Jean Louis
2022-03-11 14:55     ` Felix Dietrich [this message]
2022-03-13 14:54       ` Jean Louis
2022-03-14 20:51       ` Tomas Hlavaty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ilskedxn.fsf@sperrhaken.name \
    --to=felix.dietrich@sperrhaken.name \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.