4 changed files with 68 additions and 0 deletions
@ -0,0 +1,47 @@ |
|||||
|
#!/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="/tank/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 /var/log \ |
||||
|
"${TARGET}::${ARC_NAME}" \ |
||||
|
/ |
||||
|
# 2>> "${LOGFILE_LOCATION}/${LOGFILE}" |
||||
|
|
||||
|
sync |
@ -0,0 +1,9 @@ |
|||||
|
--- |
||||
|
- hosts: "{{ target }}" |
||||
|
gather_facts: false |
||||
|
remote_user: pi |
||||
|
roles: |
||||
|
- initpi |
||||
|
- log2ram |
||||
|
- disableswap |
||||
|
|
Loading…
Reference in new issue