I use this little program for shell-level locking, to ensure that only one invocation of a given program runs at a time.

It just checks for a pid file. If the pid file does not exist, or the pid no longer exists, it'll start the process (program), and write the new process' pid to the pid file.

It's at:

...and usage looks like:

The "string" part needs to be a unique identifier for each process you want only one of. The command, naturally, is a shell command.

It does not use locking: advisory or mandatory. Just a lock file containing a pid.


Hits: 697
Timestamp: 2024-02-29 10:12:26 PST

Back to Dan's tech tidbits

You can e-mail the author with questions or comments: