[object Object]

← back to Nas Setup

pull-dw-dump: derive retention glob from $BASE so realestate leg counts/prunes its own dumps (was hardcoded dw_unified)

20be61d46d1b98bb71abbf134ed170cba626c220 · 2026-08-13 18:04:46 -0700 · Steve

Files touched

Diff

commit 20be61d46d1b98bb71abbf134ed170cba626c220
Author: Steve <steve@designerwallcoverings.com>
Date:   Thu Aug 13 18:04:46 2026 -0700

    pull-dw-dump: derive retention glob from $BASE so realestate leg counts/prunes its own dumps (was hardcoded dw_unified)
---
 scripts/pull-dw-dump.sh | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/pull-dw-dump.sh b/scripts/pull-dw-dump.sh
index 519080b..e3fe740 100755
--- a/scripts/pull-dw-dump.sh
+++ b/scripts/pull-dw-dump.sh
@@ -120,14 +120,18 @@ pull_one(){
   fi
   log "[$LABEL] PASS: $BASE — ${SIZE_MB}MB, $TOC TOC entries → $DEST"
 
-  # retention (OFF by default; logs every deletion when enabled)
+  # retention (OFF by default; logs every deletion when enabled). The glob is derived
+  # from THIS leg's dump name ($BASE), NOT hardcoded — so the realestate leg counts/prunes
+  # realestate_*.dump instead of always globbing dw_unified_*.dump in whatever dir it was
+  # handed (which silently reported "0 local copies" for realestate). TK-10547.
+  local PREFIX="${BASE%%_[0-9]*}"   # dump-name prefix: dw_unified | realestate | …
   if [ "$RETENTION_KEEP" -gt 0 ]; then
     local f; local -a OLD=()
-    while IFS= read -r f; do OLD+=("$f"); done < <(ls -t "$DIR"/dw_unified_*.dump 2>/dev/null | tail -n +"$((RETENTION_KEEP+1))")
+    while IFS= read -r f; do OLD+=("$f"); done < <(ls -t "$DIR"/"${PREFIX}"_*.dump 2>/dev/null | tail -n +"$((RETENTION_KEEP+1))")
     for f in "${OLD[@]}"; do log "[$LABEL] retention: removing $(basename "$f")"; rm -f "$f"; done
     [ "${#OLD[@]}" -gt 0 ] && log "[$LABEL] retention: pruned ${#OLD[@]} old copy(ies), kept newest $RETENTION_KEEP"
   else
-    local COUNT; COUNT=$(ls "$DIR"/dw_unified_*.dump 2>/dev/null | wc -l | tr -d ' ')
+    local COUNT; COUNT=$(ls "$DIR"/"${PREFIX}"_*.dump 2>/dev/null | wc -l | tr -d ' ')
     log "[$LABEL] retention OFF (keep-all) — $COUNT local copies"
   fi
 

← 17bd6ce chore(nas): commit root-daemon installer scripts (TK-10323 a  ·  back to Nas Setup  ·  Add read-only daemon-health probe: surfaces root-daemon last b7fbe23 →