borg backup scripts used on KrautSpace infra
Find a file
2023-04-06 00:28:43 +02:00
borg-backup@.service init 2023-04-04 23:36:20 +02:00
borg-backup@.timer init 2023-04-04 23:36:20 +02:00
borg-prune@.service init 2023-04-04 23:36:20 +02:00
borg-prune@.timer init 2023-04-04 23:36:20 +02:00
init.sh init.sh: sandboxed borg invocations and new param-change-safeguard 2023-04-06 00:28:43 +02:00
install.sh make scripts executable 2023-04-04 23:38:44 +02:00
install_as_link.sh make scripts executable 2023-04-04 23:38:44 +02:00
LICENSE Initial commit 2023-04-04 23:07:11 +02:00
README.md working init.sh script and readme 2023-04-05 20:17:06 +02:00

borg-backup-scripts

borg backup scripte used on KrautSpace infra

Requirements

sudo apt install borg

Usage

Initialization

sudo ./init.sh remote_site_1 --host=whatever.your-storagebox.de --port=23 --login=whatever --directory=/home/borg

What this does:

  • Creates a config directory at /etc/borg/remote_site_1.
  • Creates a passphrase for borg.
  • Creates a ssh keypair for the ssh connection to your remote ssh backup destination host.
  • Deploys the ssk public key to the remote ssh account using ssh-copy-id.
  • Checks if the destination path is usable.
  • Initializes the borg repository.
  • Prints out the borg repository status if initialization was successfull.
  • Attempts to continue the init process if called multiple times.

Service installation

# on productive system: copy systemd-units in /etc/systemd/system
sudo ./install.sh

# on development system: link systemd-units from current directory
sudo ./install_as_link.sh

Service activation

sudo systemctl enable borg-backup@remote_site_1.timer
sudo systemctl enable borg-prune@remote_site_1.timer

FAQ

Why so much sudo?

Good question!
The borg backup process requires priviledges to read everything you want to backup.
The systemd-units sandbox the borg process to a read-only view of the filesystem.

Can I trust this code?

Never trust anything from the internet.
Download and verify what it does. It should be somewhat readable.