Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
What Unix commands can be used as a semaphore/lock?

I have read many similar post and the solution seems to be to use flock. flock does not exist on my system and I don't have rights to add it.


  1. A "BashFAQ" link provided in a comment in how-to-make-sure-only-one-instance-of-a-bash-script-runs talks about using flock
share|improve this question

marked as duplicate by Nils, uther, warl0ck, jasonwryan, Renan Jan 20 '13 at 2:58

This question was marked as an exact duplicate of an existing question.

How about Perl? Besides, the lock directory solution is available. – sr_ Jan 18 '13 at 15:00
@sr_ Yes I do have Perl! For portability I am hoping to avoid dependency on external programs.. – Kent Pawar Jan 18 '13 at 15:09
Anyway, I'm rather confused about your question, since none of the answers in the referenced question uses flock... – sr_ Jan 18 '13 at 15:13
@sr_ Sorry about that.. flock was mentioned in a comment. – Kent Pawar Jan 18 '13 at 15:19
@sr_ and others: note that this question specifically asks about NFS. Many NFS implementations have race conditions that break many locking techniques. Solaris's NFS implementation is better than most, but please do not close this question as a duplicate of one that doesn't focus on NFS. Kent: are all the clients and the server running Solaris? – Gilles Jan 18 '13 at 23:11

Is simple a lock file, created with touch or echo, too weak for you system?

share|improve this answer
That results in the much talked about race condition. – Kent Pawar Jan 18 '13 at 15:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.