Implements file locks for locking files and directories in UNIX.
Place a lock file on the directory at dir_path.
The lock file is placed in the root of dir_path with the name .certbot.lock.
Parameters: dir_path (str) – path to directory Returns: the locked LockFile object Return type: LockFile Raises: errors.LockError – if unable to acquire the lock
A UNIX lock file.
This lock file is released when the locked file is closed or the process exits. It cannot be used to provide synchronization between threads. It is based on the lock_file package by Martin Horcicka.
Acquire the lock file.
- errors.LockError – if lock is already held
- OSError – if unable to open or stat the lock file
Try to acquire the lock file without blocking.
Parameters: fd (int) – file descriptor of the opened file to lock
Did we successfully grab the lock?
Because this class deletes the locked file when the lock is released, it is possible another process removed and recreated the file between us opening the file and acquiring the lock.
Parameters: fd (int) – file descriptor of the opened file to lock Returns: True if the lock was successfully acquired Return type: bool
Remove, close, and release the lock file.