You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

48 lines
2.2 KiB

#!/bin/bash
#########################################################################
# Copyright (C) 2020 Akito <the@akito.ooo> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
#########################################################################
# https://borgbackup.readthedocs.io/en/stable/deployment/automated-local.html
# 0.2.0
PURPOSE="SYSTEM"
TARGET_HOST=""
LOCATION="/backup/Backup-Repo/borg/"
BORG_REPO="${HOSTNAME}"
TARGET="${TARGET_HOST}${LOCATION}${BORG_REPO}"
ARC_NAME="${HOSTNAME}+${USER}:$(date +"%Y%m%dT%H%M%S")"
BORG_COMMENT="Automated \"${PURPOSE}\" backup to repository \"${BORG_REPO}\" at \"${TARGET_HOST}${LOCATION}\" issued $(date +"%Y-%m-%dT%H:%M:%S")."
BORG_OPTS="--compression auto,lzma,9 --checkpoint-interval 900 --warning"
LOGFILE_LOCATION="/tmp"
LOGFILE="borg-${PURPOSE}_$(date +"%Y%m%dT%H%M%S").log"
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
borg create ${BORG_OPTS} \
--comment "${BORG_COMMENT}" \
--exclude /media \
--exclude /dev \
--exclude /run \
--exclude /tmp \
--exclude /sys \
--exclude /proc \
--exclude /mnt \
--exclude /tank \
--exclude /extusb \
--exclude /var/log \
"${TARGET}::${ARC_NAME}" \
/
# 2>> "${LOGFILE_LOCATION}/${LOGFILE}"
sync