summaryrefslogtreecommitdiff
path: root/rdiff-backup
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2003-11-03 10:06:22 +0000
committerJonas Smedegaard <dr@jones.dk>2003-11-03 10:06:22 +0000
commit187a21fe3334fec7f55f58555607fdfd2fc80e81 (patch)
tree4db71b74cf5234abea5cf6cedc83c471b3c51857 /rdiff-backup
parent84db7ab16be71019b3ab9d7fd5db8ab873cd8d89 (diff)
Add new area for rdiff-backup backup routine.
Diffstat (limited to 'rdiff-backup')
-rw-r--r--rdiff-backup/excludes2
-rw-r--r--rdiff-backup/rdiff-backup.inc.sh37
2 files changed, 39 insertions, 0 deletions
diff --git a/rdiff-backup/excludes b/rdiff-backup/excludes
new file mode 100644
index 0000000..dc2af4a
--- /dev/null
+++ b/rdiff-backup/excludes
@@ -0,0 +1,2 @@
+**/cache/**
+**_scache.pag.*
diff --git a/rdiff-backup/rdiff-backup.inc.sh b/rdiff-backup/rdiff-backup.inc.sh
new file mode 100644
index 0000000..9af5484
--- /dev/null
+++ b/rdiff-backup/rdiff-backup.inc.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+# Usage: Include this file, and add lines below lines like these:
+
+#rdiffit xayide.jones.dk /etc /home/jonas/websites
+#rdiffit coreander.bitbase.dk /etc /home
+#rdiffit ida.idaskolen.dk "(10000,10000)" /home
+
+
+
+function rdiffit() {
+ host="$1"; shift
+
+ # grab optional upload and download limits
+ up=""; down=""
+ if echo "$1" | grep -Eq '^\(.*\)$'; then
+ updown=`echo "$1" | sed -e 's/^(\(.*\))$/\1/'`
+ up=`echo "$updown" | awk -F, '{ print $1 }'`
+ down=`echo "$updown" | awk -F, '{ print $2 }'`
+ shift
+ fi
+ for dir in $@; do
+ if echo "$dir" | grep -Eq '^/'; then
+ dir=`echo "$dir" | sed -e 's/^\///'`
+ else
+ echo "ERROR: host \"$host\" path \"$dir\" lacks leading \"/\""
+ continue
+ fi
+ if [ "$host" = "`hostname -f`" ]; then
+ rdiff-backup --exclude '**/cache/**' --exclude '**_scache.pag.*' --exclude '**/mail/.imap/**' --exclude '**/jonas/src/**' --exclude '**/pc/downloads/**' /"$dir" "/var/local/backups/$host/rdiff-backup/${dir//\//-}"
+ elif [ -z "$up$down" ]; then
+ rdiff-backup --exclude '**/cache/**' --exclude '**_scache.pag.*' --exclude '**/mail/.imap/**' --exclude '**/jonas/src/**' --exclude '**/pc/downloads/**' --remote-schema 'ssh -o BatchMode=yes %s '\''rdiff-backup --server'\' $host::/"$dir" "/var/local/backups/$host/rdiff-backup/${dir//\//-}"
+ else
+ rdiff-backup --exclude '**/cache/**' --exclude '**_scache.pag.*' --exclude '**/mail/.imap/**' --exclude '**/jonas/src/**' --exclude '**/pc/downloads/**' --remote-schema 'cstream -t '$up' | ssh -o BatchMode=yes %s '\''rdiff-backup --server'\'' | cstream -t '$down $host::/"$dir" "/var/local/backups/$host/rdiff-backup/${dir//\//-}"
+ fi
+ done
+}