SPB Git

Repository Public

offsite-backup.sh 2.7 KB 52 lines shellscript

1#!/bin/bash2# =============================================================================3#                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : cluster-skill8# File             : operateur/remote/offsite-backup.sh9# Module           : operateur10# Repository       : https://git.spboucher.ai/cluster-skill11# Created          : 2026-11-1712# Last Modified    : 2026-11-1713#14# Author           : Simon-Pierre Boucher15# Position         : Professor of Finance16# Institution      : Université du Québec en Outaouais (UQO)17# Organization     : SP Boucher18# Website          : https://spboucher.ai19# Git              : https://git.spboucher.ai20#21# Preferred Contact: admin@spboucher.ai22# Technical Contact: dev@spboucher.ai23# Security/Admin   : admin@spboucher.ai24#25# Copyright (c) 202626# Simon-Pierre Boucher27# All rights reserved where applicable. This file is governed by the28# applicable project license, copyright notices and relevant law.29# Existing third-party rights and notices remain unaffected.30#31# License          : None specified (no license file in this repository)32#33# Do not embed credentials, private keys, access tokens,34# certificates or confidential personal information.35#36# =============================================================================37# END OF SP BOUCHER SOURCE HEADER38# =============================================================================3940# offsite-backup.sh — (nœud opérateur M5M36, 1 fois par jour) copie HORS NŒUD les sauvegardes chiffrées de Claude Remote, Codex Remote41# (M5M36:~/backups) et Agent OS (M4M64c:~/backups/agent-os) vers M3U96b:~/backups-offsite/. Les phrases de passe ne voyagent pas :42# elles sont sur le nœud d'origine et sur le laptop (~/Desktop/Cluster/secrets/<app>/backup.pass).43set -uo pipefail44DEST=M3U96b; T="$HOME/.maclustr-operator/offsite-tmp"; rc=045ssh -o BatchMode=yes "$DEST" 'mkdir -p ~/backups-offsite/claude-remote ~/backups-offsite/codex-remote ~/backups-offsite/agent-os' || { echo "$(date '+%F %T') $DEST injoignable"; exit 1; }46for a in claude-remote codex-remote; do47  rsync -rt -e "ssh -o BatchMode=yes" "$HOME/backups/$a/" "$DEST:backups-offsite/$a/" || rc=148done49mkdir -p "$T/agent-os" && rsync -rt --delete -e "ssh -o BatchMode=yes" "M4M64c:backups/agent-os/" "$T/agent-os/" && rsync -rt -e "ssh -o BatchMode=yes" "$T/agent-os/" "$DEST:backups-offsite/agent-os/" || rc=150ssh -o BatchMode=yes "$DEST" 'find ~/backups-offsite -name "*.enc" -mtime +30 -delete; for d in ~/backups-offsite/*/; do echo "$(basename $d) $(ls $d | wc -l | tr -d " ") fichiers, dernier $(ls -t $d | head -1)"; done' | sed "s/^/$(date '+%F %T') /"51exit $rc52
Files main
Menu

Theme