#!/bin/bash set -eu if pgrep borg > /dev/null; then echo "Borg is still running!" exit 1 fi source "$1" set -x ionice -c 3 -p $$ renice -n 19 -p $$ > /dev/null [ "$BACKUP_SNAP" -eq 1 ] && bsnap on cd "$BACKUP_PATH" borg create \ $([ -t 0 ] && echo --progress) \ --info --stats \ --compression lz4 \ --exclude-from "$BACKUP_EXCLUDE_FILE" \ "${BACKUP_REPO}::{hostname}-{now}" . borg prune \ --info --stats \ --keep-daily=7 \ --keep-weekly=4 \ --keep-monthly=12 \ --prefix='{hostname}-' \ "$BACKUP_REPO" [ "$BACKUP_SNAP" -eq 1 ] && bsnap off exit 0