Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Apr 2011 16:35:44 +0200
From:      Admin Cyanide <admin@cyanide-studio.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: lockf command
Message-ID:  <4DA5B4C0.3060402@cyanide-studio.com>
In-Reply-To: <4DA5A3B5.4080302@gmx.com>
References:  <4DA56819.90503@cyanide-studio.com> <4DA5A3B5.4080302@gmx.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
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"



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?4DA5B4C0.3060402>