From 45063ef46f0984ad7959fc3d6cb16f57abd2412a Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 6 Jan 2020 15:53:13 +0100 Subject: update profile --- bin/backup | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 bin/backup (limited to 'bin') diff --git a/bin/backup b/bin/backup new file mode 100755 index 0000000..2ee6b83 --- /dev/null +++ b/bin/backup @@ -0,0 +1,18 @@ +#!/bin/sh + +# incremental backup using rsync(1) + +die() { echo "$0: fatal: $@" >&2; exit 1; } + +[ "$(id -u)" = 0 ] || die must run as root + +dest=${1:-bip:/home/backup}/$(hostname) +date=$(date +%Y%m%d_%H%M%S) +last=$(rsync --list-only $dest/ 2>/dev/null | cut -b 47- | tail -1) + +case $last in +(2*) opt_link=--link-dest=../$last;; +(*) opt_link=;; +esac + +rsync -DSHxav --exclude-from=/etc/backup/ignore $opt_link / /boot /home $dest/$date -- cgit v1.2.3