dotlockfile
mailbox-style file locking utility
TLDR
Create a lockfile
SYNOPSIS
dotlockfile [options] lockfile
DESCRIPTION
dotlockfile creates lockfiles using the mailbox locking convention (name.lock). It provides atomic file locking for scripts and applications that need to serialize access to resources.
The tool handles retry logic, stale lock detection, and PID tracking. With -p, it writes the process ID to the lockfile enabling detection of dead lock holders.
dotlockfile is commonly used in shell scripts to prevent concurrent access to files or ensure only one instance of a script runs at a time.
PARAMETERS
LOCKFILE
Path to lockfile to create/remove.-r RETRIES
Number of retries (0 = try once, -1 = infinite).-u, --unlock
Remove the lockfile.-p, --use-pid
Write PID to lockfile.-l
Lock (default action).-c, --check
Check if lock is stale.--help
Display help information.
CAVEATS
Lockfiles on network filesystems may not be reliable. Must manually remove locks on script exit. Stale lock detection requires -p option. Not suitable for high-contention scenarios.
HISTORY
dotlockfile implements the traditional Unix lockfile convention, widely used for mailbox locking. It's part of the liblockfile package providing standardized file locking utilities.
