]> git.rustad.me Git - backup/commitdiff
Initial commit of script
authorEnoch Root <root@poincare.local>
Sun, 29 Apr 2018 21:01:18 +0000 (23:01 +0200)
committerEnoch Root <root@poincare.local>
Sun, 29 Apr 2018 21:01:18 +0000 (23:01 +0200)
backup.sh [new file with mode: 0755]

diff --git a/backup.sh b/backup.sh
new file mode 100755 (executable)
index 0000000..eb20770
--- /dev/null
+++ b/backup.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+# uncomment for debug
+#set -x
+
+source .duplicity.conf
+source venv2/bin/activate
+
+# duplicity command
+DUPEXEC="duplicity --encrypt-key $ENCRKEY --sign-key $SIGNKEY $DUPOPTS $*"
+# loop on directories
+echo -n "---- Incremental backup of $HOSTNAME ---- "; date
+
+for i in $BACKDIRS
+do
+  echo Starting backup of directory $i
+  # create directory, then backup, then erase old backups
+  $DUPEXEC $i b2://$B2_ACCOUNT_ID:$B2_APPLICATION_KEY@$BUCKET && $DUPEXEC $DUPOPTS_CLEANUP b2://$B2_ACCOUNT_ID:$B2_APPLICATION_KEY@$BUCKET
+  # verify backup integrity
+  #$DUPEXEC --verify b2://$B2_ACCOUNT_ID:$B2_APPLICATION_KEY@$BUCKET $i
+done
+
+echo -n "---- Finished backup on $HOSTNAME ---- "; date
+