diff --git a/src/borgwrapper.sh b/src/borgwrapper.sh index 21d40ab..d1b9d39 100755 --- a/src/borgwrapper.sh +++ b/src/borgwrapper.sh @@ -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}" diff --git a/src/config.sh.example b/src/config.sh.example index 5b7ea9a..bd4218e 100644 --- a/src/config.sh.example +++ b/src/config.sh.example @@ -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" diff --git a/systemd/borgwrapper-backup@.service b/systemd/borgwrapper-backup@.service index 292dd2e..a9adc0c 100644 --- a/systemd/borgwrapper-backup@.service +++ b/systemd/borgwrapper-backup@.service @@ -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 diff --git a/systemd/borgwrapper-verify@.service b/systemd/borgwrapper-verify@.service index 409ba55..0638867 100644 --- a/systemd/borgwrapper-verify@.service +++ b/systemd/borgwrapper-verify@.service @@ -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