Update docs/Savaneprod/2020-12-04-borg-backup.md
All checks were successful
continuous-integration/drone Build is passing
All checks were successful
continuous-integration/drone Build is passing
This commit is contained in:
@@ -26,7 +26,7 @@ Ensuite il suffit de raffraîchir la liste des paquets disponibles et Borg Appar
|
|||||||
# borg init --encryption=keyfile-blake2 /volume1/Backup/borgrepolzma/
|
# borg init --encryption=keyfile-blake2 /volume1/Backup/borgrepolzma/
|
||||||
|
|
||||||
#Formatage et mise en page
|
#Formatage et mise en page
|
||||||
stars='***************************************************************************'
|
STARS='***************************************************************************'
|
||||||
|
|
||||||
# Pour le calcul d'exécutoin du script
|
# Pour le calcul d'exécutoin du script
|
||||||
start_time=$(date +%s)
|
start_time=$(date +%s)
|
||||||
@@ -48,7 +48,7 @@ export HOME=/root
|
|||||||
# Apparue le 28/05/2020
|
# Apparue le 28/05/2020
|
||||||
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
|
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
|
||||||
|
|
||||||
printf '\n%s\n%s\n%s\n' $stars "Début de la sauvegarde " $stars 2>&1 | tee -a $log_file
|
printf '\n%s\n%s\n%s\n' "$STARS" "Début de la sauvegarde " "$STARS" 2>&1 | tee -a $log_file
|
||||||
|
|
||||||
# Préparation de la sauvegarde du nextcloud
|
# Préparation de la sauvegarde du nextcloud
|
||||||
docker exec -tiu www-data nextcloud_app_1 php occ maintenance:mode --on 2>&1 | tee -a $log_file
|
docker exec -tiu www-data nextcloud_app_1 php occ maintenance:mode --on 2>&1 | tee -a $log_file
|
||||||
@@ -75,26 +75,26 @@ docker exec -i nextcloud_db_1 /usr/bin/pg_dump -U nextcloud nextcloud | gzip -9
|
|||||||
# Fin de la sauvegarde
|
# Fin de la sauvegarde
|
||||||
docker exec -tiu www-data nextcloud_app_1 php occ maintenance:mode --off 2>&1 | tee -a $log_file
|
docker exec -tiu www-data nextcloud_app_1 php occ maintenance:mode --off 2>&1 | tee -a $log_file
|
||||||
|
|
||||||
printf '\n%s\n%s\n%s\n' $stars "PRUNE" $stars 2>&1 | tee -a $log_file
|
printf '\n%s\n%s\n%s\n' "$STARS" "PRUNE" "$STARS" 2>&1 | tee -a $log_file
|
||||||
|
|
||||||
# Keep 31 end of day, 0 additional end of week archives, and 0 end of month archive
|
# Keep 31 end of day, 0 additional end of week archives, and 0 end of month archive
|
||||||
/usr/local/bin/borg prune -v --list --stats --keep-daily=31 --keep-weekly=0 --keep-monthly=0 2>&1 | tee -a $log_file
|
/usr/local/bin/borg prune -v --list --stats --keep-daily=31 --keep-weekly=0 --keep-monthly=0 2>&1 | tee -a $log_file
|
||||||
printf '\n%s\n' '--- Fin de la sauvegarde ---' 2>&1 | tee -a $log_file
|
printf '\n%s\n' '--- Fin de la sauvegarde ---' 2>&1 | tee -a $log_file
|
||||||
|
|
||||||
printf '\n%s\n%s\n%s\n' $stars "borg info" $stars >> $log_file
|
printf '\n%s\n%s\n%s\n' "$STARS" "borg info" "$STARS" >> $log_file
|
||||||
# Pour le mail envoyé en fin par le Task Scheduler Synology
|
# Pour le mail envoyé en fin par le Task Scheduler Synology
|
||||||
/usr/local/bin/borg info borgserver:borgrepo >> $log_file
|
/usr/local/bin/borg info borgserver:borgrepo >> $log_file
|
||||||
|
|
||||||
printf '\n%s\n%s\n%s\n' $stars "...Suppression des logs de plus de 200 jours..." $stars 2>&1 | tee -a $log_file
|
printf '\n%s\n%s\n%s\n' "$STARS" "...Suppression des logs de plus de 200 jours..." "$STARS" 2>&1 | tee -a $log_file
|
||||||
find /volume1/Backup/logs -mtime +60 -exec rm -f {} \; 2>&1 | tee -a $log_file
|
find /volume1/Backup/logs -mtime +60 -exec rm -f {} \; 2>&1 | tee -a $log_file
|
||||||
|
|
||||||
timestamp=$(date +%s)
|
timestamp=$(date +%s)
|
||||||
TZ='Europe/Paris' printf '%s\nNous sommes le %(%d %b %Y)T et il est %(%H:%M:%S)T.\n%s\n' $stars $timestamp $timestamp $stars 2>&1 | tee -a $log_file
|
TZ='Europe/Paris' printf '%s\nNous sommes le %(%d %b %Y)T et il est %(%H:%M:%S)T.\n%s\n' "$STARS" $timestamp $timestamp "$STARS" 2>&1 | tee -a $log_file
|
||||||
|
|
||||||
# Calcul du temps d'exécution du script
|
# Calcul du temps d'exécution du script
|
||||||
end_time=$(date +%s)
|
end_time=$(date +%s)
|
||||||
exec_time=$(($end_time - $start_time))
|
exec_time=$(($end_time - $start_time))
|
||||||
printf '\n%s\n' $stars
|
printf '\n%s\n'"$STARS"
|
||||||
TZ='Europe/Paris' printf "L'exécution du script a duré %(%Hh%Mm%Ss)T\n" $exec_time 2>&1 | tee -a $log_file
|
TZ='Europe/Paris' printf "L'exécution du script a duré %(%Hh%Mm%Ss)T\n" $exec_time 2>&1 | tee -a $log_file
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user