#!/bin/bash # Copy the newest database dumps from the production node to the gateway (off-node backup). Run from the laptop or M1M32. set -euo pipefail NODE=${1:-M2M32b} DEST=${2:-M1M32:~/backups/satelliteindex/} ssh "${DEST%%:*}" "mkdir -p ${DEST#*:}" ssh "$NODE" 'ls -1t ~/satelliteindex-data/backups/satelliteindex-*.dump 2>/dev/null | head -3' | while read -r f; do echo "copy $NODE:$f → $DEST" ssh "$NODE" "cat $f" | ssh "${DEST%%:*}" "cat > ${DEST#*:}$(basename "$f")" done ssh "${DEST%%:*}" "ls -la ${DEST#*:} | tail -5"