spb/market-atlas
Public
TypeScript 96.7%
SQL 1.6%
CSS 0.8%
JavaScript 0.5%
1#!/bin/bash2# Copy Market Atlas backups (pg_dump metadata) and the observation archive from the production node to the gateway.3# Usage: scripts/backup-offnode.sh [node] [dest-host] (defaults: M2U64 → M1M32:~/backups/market-atlas)4set -euo pipefail5NODE=${1:-M2U64}6DEST=${2:-M1M32}7ssh "$DEST" 'mkdir -p ~/backups/market-atlas/{backups,archive}'8ssh "$NODE" 'ls ~/market-atlas-data/backups | tail -3'9# Node → laptop → gateway (nodes reach each other on the LAN, but keep the laptop as the pivot so agent forwarding works everywhere).10TMP=$(mktemp -d)11rsync -a --delete "$NODE:~/market-atlas-data/backups/" "$TMP/backups/"12rsync -a "$NODE:~/market-atlas-data/archive/" "$TMP/archive/"13rsync -a "$TMP/backups/" "$DEST:~/backups/market-atlas/backups/"14rsync -a "$TMP/archive/" "$DEST:~/backups/market-atlas/archive/"15rm -rf "$TMP"16ssh "$DEST" 'du -sh ~/backups/market-atlas'17