Add borg backup scripts

master
Jeff Moe 6 years ago
parent 783982b356
commit 959e7968ff

@ -0,0 +1,20 @@
#!/bin/bash
# Copyright (C) 2018, Fork Sand, Inc.
# Copyright (C) 2017, aleph Objects, Inc.
# GPLv3
# Generate a key thusly
# ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1] [-N new_passphrase] [-C comment] [-f output_keyfile]
# ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519-borg-`hostname`
exit 0
set -x
export BORG_SERVER="user@host"
export BORG_SSHPUBKEY="/root/.ssh/id_ed25519-borg-`hostname`.pub"
# To make it the only key:
#scp $BORG_SSHPUBKEY $BORG_SERVER:.ssh/authorized_keys
# To append the key to existing ssh keys:
cat $BORG_SSHPUBKEY | ssh $BORG_SERVER 'dd of=.ssh/authorized_keys oflag=append conv=notrunc'

@ -0,0 +1,30 @@
#!/bin/bash
# Copyright (C) 2018, Fork Sand, Inc.
# Copyright (C) 2017, aleph Objects, Inc.
# GPLv3
export BORG_REPO="BACKUPS/borg/`hostname`"
export BORG_SERVER="user@host"
export BORG_PASSPHRASE="`cat /root/.borgpw`"
export BORG_BINARY="borg1"
#export BORG_DISPLAY_PASSPHRASE=0
#export BORG_LOGGING_CONF=
export BORG_RSH="ssh -i /root/.ssh/id_ed25519-borg-`hostname`"
export BORG_REMOTE_PATH=borg1
#export BORG_FILES_CACHE_TTL=20
#export TMPDIR=
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=no
export BORG_RELOCATED_REPO_ACCESS_IS_OK=no
export BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=yes
export BORG_DELETE_I_KNOW_WHAT_I_AM_DOING=no
export BORG_KEYS_DIR="/root/.config/borg/keys"
export BORG_CACHE_DIR="/root/.cache/borg"
echo "Checking Server: $BORG_SERVER"
echo "Checking Repo: $BORG_REPO"
echo
borg check \
--verbose \
$BORG_SERVER:$BORG_REPO

@ -0,0 +1,41 @@
#!/bin/bash
# Copyright (C) 2018, Fork Sand, Inc.
# Copyright (C) 2017, aleph Objects, Inc.
# GPLv3
set -x
export MASTERDIR=/
export BORG_REPO="BACKUPS/borg/`hostname`"
export BORG_SERVER="user@host"
export BORG_PASSPHRASE="`cat /root/.borgpw`"
export BORG_BINARY="borg1"
#export BORG_DISPLAY_PASSPHRASE=0
#export BORG_LOGGING_CONF=
export BORG_RSH="ssh -i /root/.ssh/id_ed25519-borg-`hostname`"
export BORG_REMOTE_PATH=borg1
#export BORG_FILES_CACHE_TTL=20
#export TMPDIR=
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=no
export BORG_RELOCATED_REPO_ACCESS_IS_OK=no
export BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=yes
export BORG_DELETE_I_KNOW_WHAT_I_AM_DOING=no
export BORG_KEYS_DIR="/root/.config/borg/keys"
export BORG_CACHE_DIR="/root/.cache/borg"
export NOW=`date +%Y%m%d%H%M%S`
mkdir -p $BORG_KEYS_DIR
mkdir -p $BORG_CACHE_DIR
borg create \
--verbose \
--stats \
--progress \
$BORG_SERVER:$BORG_REPO::$NOW \
$MASTERDIR
# --list
# --exclude
# --one-file-system
# --numeric-owner
# --compression
# --dry-run

@ -0,0 +1,31 @@
#!/bin/bash
# Copyright (C) 2018, Fork Sand, Inc.
# Copyright (C) 2017, aleph Objects, Inc.
# GPLv3
export BORG_REPO="BACKUPS/borg/`hostname`"
export BORG_SERVER="user@host"
export BORG_PASSPHRASE="`cat /root/.borgpw`"
export BORG_BINARY="borg1"
#export BORG_DISPLAY_PASSPHRASE=0
#export BORG_LOGGING_CONF=
export BORG_RSH="ssh -i /root/.ssh/id_ed25519-borg-`hostname`"
export BORG_REMOTE_PATH=borg1
#export BORG_FILES_CACHE_TTL=20
#export TMPDIR=
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=no
export BORG_RELOCATED_REPO_ACCESS_IS_OK=no
export BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=yes
export BORG_DELETE_I_KNOW_WHAT_I_AM_DOING=no
export BORG_KEYS_DIR="/root/.config/borg/keys"
export BORG_CACHE_DIR="/root/.cache/borg"
echo "Checking Server: $BORG_SERVER"
echo "Checking Repo: $BORG_REPO"
echo
#set -x
borg info \
--verbose \
$BORG_SERVER:$BORG_REPO::20161120000000

@ -0,0 +1,39 @@
#!/bin/bash
# Copyright (C) 2018, Fork Sand, Inc.
# Copyright (C) 2017, aleph Objects, Inc.
# GPLv3
set -x
# Encryption
# export password
# restrict to certain ssh keys
# restrict ssh key commands
# Append only ?
export BORG_REPO="BACKUPS/borg/`hostname`"
export BORG_SERVER="user@host"
export BORG_PASSPHRASE="`cat /root/.borgpw`"
export BORG_BINARY="borg1"
#export BORG_DISPLAY_PASSPHRASE=0
#export BORG_LOGGING_CONF=
export BORG_RSH="ssh -i /root/.ssh/id_ed25519-borg-`hostname`"
export BORG_REMOTE_PATH=borg1
#export BORG_FILES_CACHE_TTL=20
#export TMPDIR=
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=no
export BORG_RELOCATED_REPO_ACCESS_IS_OK=no
export BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=yes
export BORG_DELETE_I_KNOW_WHAT_I_AM_DOING=no
export BORG_KEYS_DIR="/root/.config/borg/keys"
export BORG_CACHE_DIR="/root/.cache/borg"
mkdir -p $BORG_KEYS_DIR
mkdir -p $BORG_CACHE_DIR
ssh $BORG_SERVER "mkdir -p $BORG_REPO"
borg init \
--verbose \
--encryption=keyfile \
$BORG_SERVER:$BORG_REPO

@ -0,0 +1,30 @@
#!/bin/bash
# Copyright (C) 2018, Fork Sand, Inc.
# Copyright (C) 2017, aleph Objects, Inc.
# GPLv3
export BORG_REPO="BACKUPS/borg/`hostname`"
export BORG_SERVER="user@host"
export BORG_PASSPHRASE="`cat /root/.borgpw`"
export BORG_BINARY="borg1"
#export BORG_DISPLAY_PASSPHRASE=0
#export BORG_LOGGING_CONF=
export BORG_RSH="ssh -i /root/.ssh/id_ed25519-borg-`hostname`"
export BORG_REMOTE_PATH=borg1
#export BORG_FILES_CACHE_TTL=20
#export TMPDIR=
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=no
export BORG_RELOCATED_REPO_ACCESS_IS_OK=no
export BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=yes
export BORG_DELETE_I_KNOW_WHAT_I_AM_DOING=no
export BORG_KEYS_DIR="/root/.config/borg/keys"
export BORG_CACHE_DIR="/root/.cache/borg"
echo "Checking Server: $BORG_SERVER"
echo "Checking Repo: $BORG_REPO"
echo
borg list \
--verbose \
$BORG_SERVER:$BORG_REPO
Loading…
Cancel
Save