Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Semaphore - lockfile/flock

$
0
0
Hi,

I have a process which can run one instance at a time. Currently we have multiple scripts trying to kickoff this process. I wanted to implement the semaphore mechanism to achieve this.

I was going through few examples. The below code seems to be reasonable solution.

Code:

              ...
              lockfile important.lock
              ...
              access_"important"_to_your_hearts_content
              ...
              rm -f important.lock

But I am concerned about limitations, eg. we do not have much control on the filename (in the above case, "important")

Especially our team who maintains the application in Production are not experts.

Which technique (command) would you recommend (least errors and less experience to maintain)

Viewing all articles
Browse latest Browse all 16232

Trending Articles