feat: push off-site des backups vers Proton Drive (rclone)
Etage 2 de la strategie de backup : 3-2-1 complet. - rclone v1.74.4 (ARM64) + remote 'proton' sur compte DEDIE bertha.cloud@proton.me (cloisonnement : une fuite n expose pas le compte Proton principal) - push apres verification d integrite, rotation distante alignee (30) - l echec du push n echoue PAS le backup local : sortie offsite:OK(n)/KO, visible dans l alerte mail DSM - config rclone en 600 chez root (la tache DSM tourne en root)
This commit is contained in:
+17
-1
@@ -50,6 +50,22 @@ cd $DEST || exit 1
|
||||
ls -1t trilium_*.db 2>/dev/null | tail -n +$((GARDER+1)) | while read f; do rm -f "$f"; done
|
||||
|
||||
chmod 600 "$CIBLE"
|
||||
# 5. Push off-site vers Proton Drive (n echoue PAS le backup local si KO)
|
||||
REMOTE="proton:Backups/trilium"
|
||||
OFFSITE="offsite:KO"
|
||||
if command -v rclone >/dev/null 2>&1; then
|
||||
if rclone copy "$CIBLE" "$REMOTE/" --max-duration 5m >/dev/null 2>&1; then
|
||||
# rotation distante : garder les N plus recents
|
||||
rclone lsf "$REMOTE/" 2>/dev/null | grep '^trilium_.*\.db$' | sort -r | tail -n +$((GARDER+1)) | while read f; do
|
||||
rclone deletefile "$REMOTE/$f" >/dev/null 2>&1
|
||||
done
|
||||
NBREMOTE=$(rclone lsf "$REMOTE/" 2>/dev/null | grep -c '^trilium_.*\.db$')
|
||||
OFFSITE="offsite:OK($NBREMOTE)"
|
||||
fi
|
||||
else
|
||||
OFFSITE="offsite:rclone-absent"
|
||||
fi
|
||||
|
||||
TAILLE=$(du -h "$CIBLE" | cut -f1)
|
||||
RESTANT=$(ls -1 trilium_*.db 2>/dev/null | wc -l)
|
||||
echo "OK $CIBLE ($TAILLE, $NBNOTES notes, $RESTANT backups conserves)"
|
||||
echo "OK $CIBLE ($TAILLE, $NBNOTES notes, $RESTANT locaux, $OFFSITE)"
|
||||
|
||||
Reference in New Issue
Block a user