Move niceness configuration from borgwrapper to systemd unit file to reduce complexity

dev
hk 2017-09-29 14:55:05 +02:00
parent b1fee78a1c
commit 48de6e889c
4 changed files with 6 additions and 10 deletions

View File

@ -53,7 +53,7 @@ borg_backup () {
fi
${DRY_RUN} && BORG_CREATE_ARGS+=( --dry-run )
${NICE} ${BORG} create \
${BORG} create \
"${BORG_CREATE_ARGS[@]}" \
"${BORG_REPO}"::"{hostname}-$(date -u +'%Y%m%dT%H%M%SZ')" \
"${PATHS[@]}" \
@ -70,7 +70,7 @@ borg_prune () {
fi
${DRY_RUN} && BORG_PRUNE_ARGS+=( --dry-run )
${NICE} ${BORG} prune \
${BORG} prune \
"${BORG_PRUNE_ARGS[@]}" \
--prefix "{hostname}-" \
--keep-daily=${KEEP_DAILY} \
@ -87,7 +87,7 @@ borg_verify () {
)
fi
${NICE} ${BORG} check "${BORG_CHECK_ARGS[@]}" "${BORG_REPO}"
${BORG} check "${BORG_CHECK_ARGS[@]}" "${BORG_REPO}"
}
borg_delete_checkpoints () {
@ -103,7 +103,7 @@ borg_delete_checkpoints () {
borg_exec () {
export BORG_REPO
${NICE} ${BORG} "$@"
${BORG} "$@"
}
convert_rate () {
@ -175,8 +175,6 @@ DRY_RUN=false
BORG="/usr/bin/borg"
LOCKDIR="/run/lock/borgwrapper"
BWLIMIT=0
USE_NICE=true
NICE="$(command -v nice)"
while getopts ":c:dV" OPT; do
case ${OPT} in
@ -204,7 +202,6 @@ MODE="${1}"
echo "Loading config from ${CONFIG}"
source "${CONFIG}" || exit 1
export BORG_PASSPHRASE
! ${USE_NICE} && NICE=""
LOCKFILE="${LOCKDIR}/$(echo -n "${BORG_REPO}" | md5sum | cut -d ' ' -f 1).lock"
mkdir -p "${LOCKDIR}"

View File

@ -27,9 +27,6 @@ KEEP_YEARLY=5
# You can use K, M, G or T binary prefixes (power of 1024), e.g., 5M = 5MiB/s = 5242880 bytes/s.
#BWLIMIT=0
# Use nice to reduce system performance impact from backups. Set to false to disable.
#USE_NICE=true
# Location of borgwrapper lock files
#LOCKDIR="/run/lock/borgwrapper"

View File

@ -5,5 +5,6 @@ After=network.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/borgwrapper -c /etc/borgwrapper/%i.sh backup
Nice=10
User=root
Group=root

View File

@ -5,5 +5,6 @@ After=network.target borgwrapper-backup@%i.service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/borgwrapper -c /etc/borgwrapper/%i.sh verify
Nice=10
User=root
Group=root