Move niceness configuration from borgwrapper to systemd unit file to reduce complexity
parent
b1fee78a1c
commit
48de6e889c
|
|
@ -53,7 +53,7 @@ borg_backup () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${DRY_RUN} && BORG_CREATE_ARGS+=( --dry-run )
|
${DRY_RUN} && BORG_CREATE_ARGS+=( --dry-run )
|
||||||
${NICE} ${BORG} create \
|
${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[@]}" \
|
||||||
|
|
@ -70,7 +70,7 @@ borg_prune () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${DRY_RUN} && BORG_PRUNE_ARGS+=( --dry-run )
|
${DRY_RUN} && BORG_PRUNE_ARGS+=( --dry-run )
|
||||||
${NICE} ${BORG} prune \
|
${BORG} prune \
|
||||||
"${BORG_PRUNE_ARGS[@]}" \
|
"${BORG_PRUNE_ARGS[@]}" \
|
||||||
--prefix "{hostname}-" \
|
--prefix "{hostname}-" \
|
||||||
--keep-daily=${KEEP_DAILY} \
|
--keep-daily=${KEEP_DAILY} \
|
||||||
|
|
@ -87,7 +87,7 @@ borg_verify () {
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${NICE} ${BORG} check "${BORG_CHECK_ARGS[@]}" "${BORG_REPO}"
|
${BORG} check "${BORG_CHECK_ARGS[@]}" "${BORG_REPO}"
|
||||||
}
|
}
|
||||||
|
|
||||||
borg_delete_checkpoints () {
|
borg_delete_checkpoints () {
|
||||||
|
|
@ -103,7 +103,7 @@ borg_delete_checkpoints () {
|
||||||
|
|
||||||
borg_exec () {
|
borg_exec () {
|
||||||
export BORG_REPO
|
export BORG_REPO
|
||||||
${NICE} ${BORG} "$@"
|
${BORG} "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
convert_rate () {
|
convert_rate () {
|
||||||
|
|
@ -175,8 +175,6 @@ DRY_RUN=false
|
||||||
BORG="/usr/bin/borg"
|
BORG="/usr/bin/borg"
|
||||||
LOCKDIR="/run/lock/borgwrapper"
|
LOCKDIR="/run/lock/borgwrapper"
|
||||||
BWLIMIT=0
|
BWLIMIT=0
|
||||||
USE_NICE=true
|
|
||||||
NICE="$(command -v nice)"
|
|
||||||
|
|
||||||
while getopts ":c:dV" OPT; do
|
while getopts ":c:dV" OPT; do
|
||||||
case ${OPT} in
|
case ${OPT} in
|
||||||
|
|
@ -204,7 +202,6 @@ MODE="${1}"
|
||||||
echo "Loading config from ${CONFIG}"
|
echo "Loading config from ${CONFIG}"
|
||||||
source "${CONFIG}" || exit 1
|
source "${CONFIG}" || exit 1
|
||||||
export BORG_PASSPHRASE
|
export BORG_PASSPHRASE
|
||||||
! ${USE_NICE} && NICE=""
|
|
||||||
|
|
||||||
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,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.
|
# 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 impact from backups. Set to false to disable.
|
|
||||||
#USE_NICE=true
|
|
||||||
|
|
||||||
# Location of borgwrapper lock files
|
# Location of borgwrapper lock files
|
||||||
#LOCKDIR="/run/lock/borgwrapper"
|
#LOCKDIR="/run/lock/borgwrapper"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,6 @@ After=network.target
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/usr/local/bin/borgwrapper -c /etc/borgwrapper/%i.sh backup
|
ExecStart=/usr/local/bin/borgwrapper -c /etc/borgwrapper/%i.sh backup
|
||||||
|
Nice=10
|
||||||
User=root
|
User=root
|
||||||
Group=root
|
Group=root
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,6 @@ After=network.target borgwrapper-backup@%i.service
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/usr/local/bin/borgwrapper -c /etc/borgwrapper/%i.sh verify
|
ExecStart=/usr/local/bin/borgwrapper -c /etc/borgwrapper/%i.sh verify
|
||||||
|
Nice=10
|
||||||
User=root
|
User=root
|
||||||
Group=root
|
Group=root
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue