From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tomas Hlavaty Newsgroups: gmane.emacs.help Subject: Re: How I am handling msmtp queues Date: Mon, 14 Mar 2022 21:51:20 +0100 Message-ID: <87fsnkxnp3.fsf@logand.com> References: <87lexhbwx9.fsf@sperrhaken.name> <87ilskedxn.fsf@sperrhaken.name> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16290"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Felix Dietrich , help-gnu-emacs@gnu.org To: Jean Louis Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 14 21:52:06 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nTrfi-00040H-1B for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 14 Mar 2022 21:52:06 +0100 Original-Received: from localhost ([::1]:47956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTrfg-000806-GI for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 14 Mar 2022 16:52:04 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:52082) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTrfA-0007vp-8j for help-gnu-emacs@gnu.org; Mon, 14 Mar 2022 16:51:32 -0400 Original-Received: from logand.com ([37.48.87.44]:52260) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTrf8-0003vE-H6 for help-gnu-emacs@gnu.org; Mon, 14 Mar 2022 16:51:31 -0400 Original-Received: by logand.com (Postfix, from userid 1001) id 5C4EA1ADD36; Mon, 14 Mar 2022 21:51:22 +0100 (CET) X-Mailer: emacs 27.2 (via feedmail 11-beta-1 I) In-Reply-To: <87ilskedxn.fsf@sperrhaken.name> Received-SPF: pass client-ip=37.48.87.44; envelope-from=tom@logand.com; helo=logand.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:136547 Archived-At: On Fri 11 Mar 2022 at 15:55, Felix Dietrich wrote: > Jean Louis writes: >> * Felix Dietrich [2022-03-10 19:33]: >>> Jean Louis writes: >>>> # wait for a lock that another instance has set >>>> WAIT=3D0 >>>> while [ -e "$LOCKFILE" -a "$WAIT" -lt "$MAXWAIT" ]; do >>>> >>>> # [=E2=80=A6] >>>> >>>> # 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=20=20=20 > 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")