Implement nice support
parent
740621b4e4
commit
45dee2be9f
|
|
@ -56,7 +56,7 @@ borg_backup () {
|
||||||
BORG_CREATE_ARGS+=( --dry-run )
|
BORG_CREATE_ARGS+=( --dry-run )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${BORG} create \
|
${NICE} ${BORG} create \
|
||||||
"${BORG_CREATE_ARGS[@]}" \
|
"${BORG_CREATE_ARGS[@]}" \
|
||||||
"${BORG_REPO}"::"{hostname}-$(date -u +'%Y%m%dT%H%M%SZ')" \
|
"${BORG_REPO}"::"{hostname}-$(date -u +'%Y%m%dT%H%M%SZ')" \
|
||||||
"${PATHS[@]}" \
|
"${PATHS[@]}" \
|
||||||
|
|
@ -76,7 +76,7 @@ borg_prune () {
|
||||||
BORG_PRUNE_ARGS+=( --dry-run )
|
BORG_PRUNE_ARGS+=( --dry-run )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${BORG} prune \
|
${NICE} ${BORG} prune \
|
||||||
"${BORG_PRUNE_ARGS[@]}" \
|
"${BORG_PRUNE_ARGS[@]}" \
|
||||||
--prefix "{hostname}-" \
|
--prefix "{hostname}-" \
|
||||||
--keep-daily=${KEEP_DAILY} \
|
--keep-daily=${KEEP_DAILY} \
|
||||||
|
|
@ -93,7 +93,7 @@ borg_verify () {
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${BORG} check "${BORG_CHECK_ARGS[@]}" "${BORG_REPO}"
|
${NICE} ${BORG} check "${BORG_CHECK_ARGS[@]}" "${BORG_REPO}"
|
||||||
}
|
}
|
||||||
|
|
||||||
borg_delete_checkpoints () {
|
borg_delete_checkpoints () {
|
||||||
|
|
@ -112,7 +112,7 @@ borg_delete_checkpoints () {
|
||||||
|
|
||||||
borg_exec () {
|
borg_exec () {
|
||||||
export BORG_REPO
|
export BORG_REPO
|
||||||
${BORG} "$@"
|
${NICE} ${BORG} "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
write_backup_status () {
|
write_backup_status () {
|
||||||
|
|
@ -215,6 +215,8 @@ BORG="/usr/bin/borg"
|
||||||
LOCKDIR="/run/lock/borgwrapper"
|
LOCKDIR="/run/lock/borgwrapper"
|
||||||
STATUSDIR="/var/lib/borgwrapper/status"
|
STATUSDIR="/var/lib/borgwrapper/status"
|
||||||
BWLIMIT=0
|
BWLIMIT=0
|
||||||
|
USE_NICE=true
|
||||||
|
NICE="/usr/bin/nice"
|
||||||
|
|
||||||
while getopts ":c:dV" OPT; do
|
while getopts ":c:dV" OPT; do
|
||||||
case ${OPT} in
|
case ${OPT} in
|
||||||
|
|
@ -243,6 +245,10 @@ echo "Loading config from ${CONFIG}"
|
||||||
source "${CONFIG}" || exit 1
|
source "${CONFIG}" || exit 1
|
||||||
export BORG_PASSPHRASE
|
export BORG_PASSPHRASE
|
||||||
|
|
||||||
|
if ! ${USE_NICE}; then
|
||||||
|
NICE=""
|
||||||
|
fi
|
||||||
|
|
||||||
LOCKFILE="${LOCKDIR}/$(echo -n "${BORG_REPO}" | md5sum | cut -d ' ' -f 1).lock"
|
LOCKFILE="${LOCKDIR}/$(echo -n "${BORG_REPO}" | md5sum | cut -d ' ' -f 1).lock"
|
||||||
mkdir -p "${LOCKDIR}"
|
mkdir -p "${LOCKDIR}"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,10 @@ 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
|
||||||
|
|
||||||
|
# Use nice to reduce system performance impacts from backups. Set to false to disable.
|
||||||
|
#USE_NICE=true
|
||||||
|
#NICE="/usr/bin/nice"
|
||||||
|
|
||||||
# Location of borgwrapper lock files
|
# Location of borgwrapper lock files
|
||||||
#LOCKDIR="/run/lock/borgwrapper"
|
#LOCKDIR="/run/lock/borgwrapper"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue