From b505aa76fc27eeec29ba88f9821ff664628d0415 Mon Sep 17 00:00:00 2001 From: tykayn Date: Fri, 28 May 2021 11:36:54 +0200 Subject: [PATCH] Ajouter 'borg_spaceship.sh' --- borg_spaceship.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 borg_spaceship.sh diff --git a/borg_spaceship.sh b/borg_spaceship.sh new file mode 100644 index 00000000..ada536f3 --- /dev/null +++ b/borg_spaceship.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# pour créer le dépot borg: +#  borg init --encryption=repokey-blake2 /media/tykayn/catwoman/backup_land4to +# +# pour changer le mot de passe +# https://borgbackup.readthedocs.io/en/stable/usage/key.html +# +# borg key change-passphrase -v /media/tykayn/catwoman/backup_land4to +# et modifier le fichier .borg-passphrase +# +# sys borg root pass +# ➜ exporter en sauvegarde papier la clé du dépot +# borg key export --paper ./backups +# To restore key use: +# borg key import --paper /path/to/repo +# +# ---------------------- creation de borg backup sur le spaceship dans le dépot borg local pour aller plus vite et ensuite syncro avec disque externe. + +export BORG_PASSCOMMAND="cat /media/tykayn/catwoman/stockage-syncable/.borg-passphrase" # ce fichier doit être lisible uniquement par l'utilsateur gérant ces archives, et ce dossier doit être sur un disque dur chiffré +export ARCHIVE_CLEAR="/media/tykayn/catwoman/stockage-syncable" # place where we have our things sorted, other than home +export LOG_FILE_BACKUP_DATES="$ARCHIVE_CLEAR/www/backup/summary_log_backup.log" # log dates of execution of the script + +export today=`date`+"%Y-%m-%d_%H-%I-%S" +export SPACESHIP_BORG_REPO=/media/tykayn/catwoman/backup_land4to +export LOG_FILE_BACKUP="$ARCHIVE_CLEAR/www/backup/log_backup.log" + +echo ' ' >> $LOG_FILE_BACKUP +echo "### ${today} | SPACESHIP | start backup script borg_spaceship.sh " >> $LOG_FILE_BACKUP + + borg create $SPACESHIP_BORG_REPO::tk-spaceship_stockage-syncable_{user}-{now} $ARCHIVE_CLEAR /home/tykayn /var/www/html --exclude node_modules --progress --verbose --stats --compression zlib,9 | tee -a $LOG_FILE_BACKUP 2>&1 + # nettoyage + borg prune -v --list --stats --keep-daily=8 --keep-weekly=6 --keep-monthly=3 --keep-yearly=2 $SPACESHIP_BORG_REPO | tee -a $LOG_FILE_BACKUP 2>&1 + +echo "### ${date} | SPACESHIP | done borg_spaceship.sh " >> $LOG_FILE_BACKUP +borg list $SPACESHIP_BORG_REPO | tee -a $LOG_FILE_BACKUP_DATES 2>&1 +date -ud "@$SECONDS" "+Time elapsed: %H:%M:%S" | tee -a $LOG_FILE_BACKUP_DATES 2>&1 \ No newline at end of file