From owner-freebsd-questions@FreeBSD.ORG Wed Apr 13 14:54:32 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DBB2106564A for ; Wed, 13 Apr 2011 14:54:32 +0000 (UTC) (envelope-from admin@cyanide-studio.com) Received: from mail.cyanide-studio.com (mail.cyanide-studio.com [62.73.7.64]) by mx1.freebsd.org (Postfix) with ESMTP id 20A1F8FC0C for ; Wed, 13 Apr 2011 14:54:31 +0000 (UTC) Received: from localhost (unknown [10.1.8.14]) by mail.cyanide-studio.com (Postfix) with ESMTP id 4FB7D17BF444 for ; Wed, 13 Apr 2011 16:35:44 +0200 (CEST) Received: from mail.cyanide-studio.com ([10.1.8.3]) by localhost (mailguard.cyanide-studio.com [10.1.8.14]) (amavisd-maia, port 10024) with ESMTP id 59041-10 for ; Wed, 13 Apr 2011 16:35:44 +0200 (CEST) Received: from [10.1.8.96] (unknown [10.1.8.96]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: bsemene@cyanide-studio.com) by mail.cyanide-studio.com (Postfix) with ESMTP id 2B43017BF440 for ; Wed, 13 Apr 2011 16:35:44 +0200 (CEST) Message-ID: <4DA5B4C0.3060402@cyanide-studio.com> Date: Wed, 13 Apr 2011 16:35:44 +0200 From: Admin Cyanide Organization: Cyanide User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.2.15) Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9 MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <4DA56819.90503@cyanide-studio.com> <4DA5A3B5.4080302@gmx.com> In-Reply-To: <4DA5A3B5.4080302@gmx.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: lockf command X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Apr 2011 14:54:32 -0000 Hi Nikos, I was stupid not to think about this... And it is a nice tip to use a new shell as a running process. However, I re-read the lockf man and saw : "By default, lockf waits indefinitely to acquire the lock." Everything is clear now. Thanks ! Le 13/04/2011 15:23, Nikos Vassiliadis a écrit : > On 4/13/2011 12:08 PM, Bastien Semene wrote: >> I wish that if command #2 can't acquire the lock, lockf exits (exit 0 >> would be nice). >> If I set -t 1, lockf is quite what I'm waiting for. But I like to do >> this in a clear way : if it can't acquire the lock it exits, no timeout >> wait. >> >> Am I misunderstanding something ? What should I change ? >> > > You should use -t0, something like: >> lab# lockf -t 0 /tmp/lock /bin/csh >> You have mail. >> lab# lockf -t 0 /tmp/lock /bin/csh >> lockf: /tmp/lock: already locked >> lab# echo $? >> 75 >> lab# > > HTH, Nikos > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org"