lockf command

Admin Cyanide admin at cyanide-studio.com
Wed Apr 13 14:54:32 UTC 2011


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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to 
> "freebsd-questions-unsubscribe at freebsd.org"


More information about the freebsd-questions mailing list