mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-03-24 01:51:05 +01:00
Merge pull request #86 from petrkle/lock-dir-writable
Check if directory for LOCKFILE is writable.
This commit is contained in:
@@ -77,6 +77,8 @@ init_system() {
|
||||
load_config
|
||||
|
||||
# Lockfile handling (prevents concurrent access)
|
||||
LOCKDIR="$(dirname "${LOCKFILE}")"
|
||||
[[ -w "${LOCKDIR}" ]] || _exiterr "Directory ${LOCKDIR} for LOCKFILE ${LOCKFILE} is not writable, aborting."
|
||||
( set -C; date > "${LOCKFILE}" ) 2>/dev/null || _exiterr "Lock file '${LOCKFILE}' present, aborting."
|
||||
remove_lock() { rm -f "${LOCKFILE}"; }
|
||||
trap 'remove_lock' EXIT
|
||||
|
||||
Reference in New Issue
Block a user