aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorÓscar Nájera <hi@oscarnajera.com>2020-08-31 17:11:46 +0200
committerÓscar Nájera <hi@oscarnajera.com>2020-08-31 17:11:46 +0200
commit9b1cbc029e03a01957764a11aa8ea5f0f0ee9590 (patch)
tree6635a0ffbddb7347fb9345120b8185c012e890e6
parentcf844e2e967a4a5eb48b36b54c849dc3a85b96ca (diff)
downloaddotfiles-9b1cbc029e03a01957764a11aa8ea5f0f0ee9590.tar.gz
dotfiles-9b1cbc029e03a01957764a11aa8ea5f0f0ee9590.tar.bz2
dotfiles-9b1cbc029e03a01957764a11aa8ea5f0f0ee9590.zip
backup files
-rwxr-xr-x.local/bin/backup.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/.local/bin/backup.sh b/.local/bin/backup.sh
new file mode 100755
index 0000000..15e1085
--- /dev/null
+++ b/.local/bin/backup.sh
@@ -0,0 +1,34 @@
+#! /bin/bash
+
+backup_local(){
+ # external program to supply the passphrase:
+ export BORG_PASSCOMMAND="pass show $1" # repo pass first arg
+
+ # Create Local Backups
+ echo $( date ) "Creating Local Backups ..."
+ REPOSITORY=$2 # repo vault path second arg
+ shift 2 # consume the first 2 arguments
+ borg create --list --filter AME --stats --compression=lz4 \
+ --progress --exclude '*.pyc' \
+ --exclude '*/.mypy_cache/' \
+ --exclude '*/.notmuch' \
+ --exclude '*/node_modules' \
+ --exclude '*/mpd/log' \
+ --exclude '*/venv/' \
+ --exclude '*/.tox/' \
+ --exclude '*.elc' \
+ $REPOSITORY::'{hostname}-{user}-{utcnow:%Y-%m-%dT%H:%M:%S}' \
+ $@ # all the dirs to bac
+
+ # Prune Local Backups
+ echo $( date ) "Pruning local repository ..."
+
+ borg prune --verbose --stats --list \
+ --prefix='{hostname}-{user}-' \
+ --keep-daily 7 \
+ --keep-weekly 4 \
+ --keep-monthly 6 $REPOSITORY
+}
+
+#backup_local borgbackup ssh://backup/media/Backup/daily_backup/ ~/dev/ ~/.mail/ ~/Nextcloud/ ~/org/ /media/backup/personal/MEGA/ /media/backup/personal/Libros/ /media/backup/personal/dev/ /media/backup/Archives/
+backup_local Admin/sarah/borg/oscar ssh://borgbackup@najera.pw/./repos/oscar ~/dev/ ~/.mail/ ~/Nextcloud/ ~/org/