summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2020-01-06 15:53:13 +0100
committerMarc Vertes <mvertes@free.fr>2020-01-06 15:53:13 +0100
commit45063ef46f0984ad7959fc3d6cb16f57abd2412a (patch)
treeb3359815c98c4fada7e4eb764671018f4b69e0dd
parent2447052de6d6b2d400b2880c8f9b61f4a5422283 (diff)
update profile
-rw-r--r--.profile4
-rwxr-xr-xbin/backup18
2 files changed, 20 insertions, 2 deletions
diff --git a/.profile b/.profile
index 0767a42..8263305 100644
--- a/.profile
+++ b/.profile
@@ -1,7 +1,7 @@
# ~/.profile
+[ -f ~/.profile-$HOSTNAME ] && . ~/.profile-$HOSTNAME
+
export PATH=~/bin:$PATH:~/go/bin
[ "${SHELL##*/}" = bash ] && [ -f ~/.bashrc ] && . ~/.bashrc
-
-[ -f ~/.profile-$HOSTNAME ] && . ~/.profile-$HOSTNAME
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