[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How I am handling msmtp queues
From: |
Tomas Hlavaty |
Subject: |
Re: How I am handling msmtp queues |
Date: |
Mon, 14 Mar 2022 21:51:20 +0100 |
On Fri 11 Mar 2022 at 15:55, Felix Dietrich <felix.dietrich@sperrhaken.name>
wrote:
> Jean Louis <bugs@gnu.support> writes:
>> * Felix Dietrich <felix.dietrich@sperrhaken.name> [2022-03-10 19:33]:
>>> Jean Louis <bugs@gnu.support> writes:
>>>> # 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
you probably want
flock
or
flock -n
see (man "flock")