2023-01-16 19:44:21 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
BINDIR=$(dirname "$0")
|
|
|
|
|
2023-01-21 16:25:50 +01:00
|
|
|
cd "$BINDIR"
|
2023-01-16 19:44:21 +01:00
|
|
|
|
|
|
|
echo "================================================================================"
|
|
|
|
echo " Sauvegardes du "$(date)
|
|
|
|
echo "================================================================================"
|
2023-01-20 00:45:52 +01:00
|
|
|
START_TIME=$(date +"%s")
|
2023-01-27 08:11:42 +01:00
|
|
|
START_SIZE=$(du -s /var/backups/borg/ | awk '{ print $1 }')
|
2023-01-16 19:44:21 +01:00
|
|
|
|
2024-05-31 16:46:48 +02:00
|
|
|
## Remount backup drive
|
|
|
|
sync
|
|
|
|
umount /var/backups
|
|
|
|
mount /var/backups
|
|
|
|
|
2023-03-21 16:42:01 +01:00
|
|
|
## Fix owner.
|
2023-04-06 11:22:46 +02:00
|
|
|
chown -R borg.borg /var/backups/borg/
|
2023-03-21 16:42:01 +01:00
|
|
|
|
2023-01-21 16:25:50 +01:00
|
|
|
## Local machine.
|
2023-01-27 08:11:42 +01:00
|
|
|
./dobackup-local
|
2023-01-16 19:44:21 +01:00
|
|
|
|
2023-03-21 16:42:01 +01:00
|
|
|
## Rsync machines.
|
|
|
|
./dobackup-rsync leparc.libre-en-communs.org
|
|
|
|
./dobackup-rsync fontainebleau.libre-en-communs.org
|
|
|
|
|
|
|
|
DURATION=$(($(date +"%s")-$START_TIME))
|
|
|
|
DURATION=$(printf "%02d:%02d:%02d" $((DURATION/60/60)) $((DURATION/60%60)) $((DURATION%60)))
|
|
|
|
echo "Midded at: "$(date)" Duration: $DURATION"
|
|
|
|
|
|
|
|
# Wait the end of remote Systemd timer backup (5 hours).
|
|
|
|
# Useful to have good data in report.
|
|
|
|
sleep 18000
|
2023-01-21 16:25:50 +01:00
|
|
|
|
|
|
|
./doreport
|
2023-01-16 19:44:21 +01:00
|
|
|
|
|
|
|
echo "====="
|
2023-01-20 00:45:52 +01:00
|
|
|
DURATION=$(($(date +"%s")-$START_TIME))
|
2023-01-27 08:11:42 +01:00
|
|
|
DURATION=$(printf "%02d:%02d:%02d" $((DURATION/60/60)) $((DURATION/60%60)) $((DURATION%60)))
|
|
|
|
END_SIZE=$(du -s /var/backups/borg/ | awk '{ print $1 }')
|
|
|
|
DIFF_SIZE=$(((END_SIZE-START_SIZE)/1024))
|
|
|
|
echo "Ended at: "$(date)" Duration: $DURATION Size: $DIFF_SIZE MB"
|
2023-01-16 19:44:21 +01:00
|
|
|
echo "================================================================================"
|