Autogenerate lockfiles based on BORG_REPO
parent
c6c34e3bcc
commit
fe2cda0598
|
|
@ -171,8 +171,8 @@ exit_clean () {
|
||||||
|
|
||||||
# Default parameters
|
# Default parameters
|
||||||
CONFIG="/etc/borgwrapper/config.sh"
|
CONFIG="/etc/borgwrapper/config.sh"
|
||||||
LOCKFILE="/var/lock/borgwrapper.lock"
|
|
||||||
BORG="/usr/bin/borg"
|
BORG="/usr/bin/borg"
|
||||||
|
LOCKDIR="/run/lock/borgwrapper"
|
||||||
PRE_BACKUP_CMD=()
|
PRE_BACKUP_CMD=()
|
||||||
POST_BACKUP_CMD=()
|
POST_BACKUP_CMD=()
|
||||||
POST_VERIFY_CMD=()
|
POST_VERIFY_CMD=()
|
||||||
|
|
@ -198,6 +198,9 @@ echo "Loading config from ${CONFIG}"
|
||||||
source "${CONFIG}" || exit 1
|
source "${CONFIG}" || exit 1
|
||||||
export BORG_PASSPHRASE
|
export BORG_PASSPHRASE
|
||||||
|
|
||||||
|
LOCKFILE="${LOCKDIR}/$(echo -n "${BORG_REPO}" | md5sum | cut -d ' ' -f 1).lock"
|
||||||
|
mkdir -p "${LOCKDIR}"
|
||||||
|
|
||||||
(
|
(
|
||||||
# Ensure this is the only instance running
|
# Ensure this is the only instance running
|
||||||
flock -n 9 || lock_failed
|
flock -n 9 || lock_failed
|
||||||
|
|
@ -237,4 +240,4 @@ export BORG_PASSPHRASE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit_clean 0
|
exit_clean 0
|
||||||
) 9>${LOCKFILE}
|
) 9>"${LOCKFILE}"
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,8 @@ KEEP_YEARLY=5
|
||||||
# You can use K, M, G or T binary prefixes (power of 1024), e.g., 5M = 5MiB/s = 5242880 bytes/s.
|
# You can use K, M, G or T binary prefixes (power of 1024), e.g., 5M = 5MiB/s = 5242880 bytes/s.
|
||||||
#BWLIMIT=0
|
#BWLIMIT=0
|
||||||
|
|
||||||
# Change this if you need to have multiple borgwrapper instances running
|
# Location of borgwrapper lock files
|
||||||
# using different configs.
|
#LOCKDIR="/run/lock/borgwrapper"
|
||||||
#LOCKFILE="/var/lock/borgwrapper.lock"
|
|
||||||
|
|
||||||
# Command to execute before backup, e.g., taking a ZFS snapshot. Must return successfully
|
# Command to execute before backup, e.g., taking a ZFS snapshot. Must return successfully
|
||||||
# for backup to start. POST_BACKUP_CMD is executed even if this fails.
|
# for backup to start. POST_BACKUP_CMD is executed even if this fails.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue