Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/interplane-forge/blob/main/infra/spark/edge-mirror.sh # interplane-forge INTERPLANE Forge Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `interplane-forge / infra / spark / edge-mirror.sh` 26 lines ยท 1397 bytes Raw Blame History 1 #!/bin/sh 2 # spark/edge-mirror.sh: keep the Spark front door's site folders equal to the hub Pi's. 3 # The publishers (aienos.com deploy, interplane.io sync-to-hub, hive-publish, stats collect.sh) 4 # still write to the Pi; this pulls each folder to the same path on the Spark, one way only. 5 # Runs from the spark user timer edge-mirror.timer and, for interplane.io publishes, from 6 # edge-mirror-onchange.service. One run at a time (lock below). Never writes to the Pi. 7 # Host tools: rsync 3.2.7 + OpenSSH (Spark), rsync on the Pi. Omega replacement: publishers 8 # write straight to the Spark once the Pi is retired as a web host (then this script goes). 9 set -u 10 HUB=${HUB:-hub} 11 LOG=${EDGE_MIRROR_LOG:-$HOME/.local/state/edge-mirror.log} 12 mkdir -p "$(dirname "$LOG")" 13 # Wait (not skip) when the other runner holds the lock, so a change seen during its run is still pulled. 14 exec 9>>"${EDGE_MIRROR_LOCK:-${XDG_RUNTIME_DIR:-/tmp}/edge-mirror.lock}" 15 flock 9 16 rc=0 17 for d in aienos.com aienos-code aienos-hive aienos-stats interplane.io replicate si; do 18 if ! timeout 900 rsync -a -H --delete --chmod=a+rX --timeout=120 \ 19 -e 'ssh -o BatchMode=yes -o ConnectTimeout=60' \ 20 --rsync-path='nice -n 15 ionice -c3 rsync' \ 21 "$HUB:/var/www/$d/" "/var/www/$d/" >>"$LOG" 2>&1; then 22 echo "$(date -u +%FT%TZ) FAIL $d" >>"$LOG"; rc=1 23 fi 24 done 25 echo "$(date -u +%FT%TZ) done rc=$rc" >>"$LOG" 26 exit $rc