dispatch-turn.sh (headless turn launcher with TURN_MODEL routing), queue-after.sh (serial gate chain + quota-wall guard), pmo-heartbeat.sh (PMO wake loop), quota-probe-then-chain.sh (post-wall relaunch).
95 lines
3.9 KiB
Bash
Executable File
95 lines
3.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# root-archive-tmp-artifacts.sh — archive /tmp agent artifacts into _crossfeed.
|
|
# meta (stack launchers/coordinate/crossfeed tooling) -> tooling/agent-stack/artifacts-archive/
|
|
# everything else (ops/tickets/monitoring) -> coo/artifacts-archive/
|
|
# Usage: sudo bash root-archive-tmp-artifacts.sh [--dry-run]
|
|
set -euo pipefail
|
|
|
|
DRY=0; [ "${1:-}" = "--dry-run" ] && DRY=1
|
|
[ "$(id -u)" -eq 0 ] || { echo "ERROR: run with sudo"; exit 1; }
|
|
|
|
SRC=/tmp
|
|
META_ROOT=/home/_crossfeed/tooling/agent-stack/artifacts-archive
|
|
COO_ROOT=/home/_crossfeed/coo/artifacts-archive
|
|
STAMP=$(date +%Y%m%d-%H%M%S)
|
|
META_DEST="$META_ROOT/$STAMP"
|
|
COO_DEST="$COO_ROOT/$STAMP"
|
|
|
|
# Never touch: system entries + .crush (live TSGCOO crush session data)
|
|
is_system() {
|
|
case "$1" in
|
|
systemd-private-*|.X11-unix|.ICE-unix|.font-unix|.Test-unix|.XIM-unix|.IMAP-unix|\
|
|
sddm*|xauth_*|ssh-*|scoped_dir*|.crush) return 0 ;;
|
|
*) return 1 ;;
|
|
esac
|
|
}
|
|
|
|
# Meta-scoped: stack launchers, coordinate/crossfeed setup, prompts, boot captures, standdown kits
|
|
is_meta() {
|
|
case "$1" in
|
|
launch-all-tsg-stacks.sh|launch-tsgcoo-stack.sh|launch-coordinate.sh|\
|
|
setup-tsg-stack.sh|setup-tsgcoo-coordinate.sh|\
|
|
tsg-pmo-autorelaunch.sh|tsg-stack-relaunch.sh.deprecated-20260828|tsg-crossfeed-setup.sh|\
|
|
tsg-agent-stacks.service|tsgcoo-bootstrap.sh|tsgcoo-cleanup.sh|tsgcoo-crush-prompt.md|\
|
|
tsgcoo-crush-prompt.oneline|tsgcoo-paste.sh|tsgcoo-pmo2.sh|tsgcoo-preflight.sh|\
|
|
tsgcoo-screen-setup.sh|tsgcoo-stack-fix.sh|tsgcoo-stack-fix2.sh|\
|
|
mk-coordinate.sh|rm-coordinate.sh|local-pmo.sh|pmo-check.sh|pmo-prompt.md|pmo-prompt.oneline|\
|
|
prompt-knel-basis.md|prompt-legacy-fold.md|legacy-fold.log|\
|
|
seed-intros.sh|run-seed.sh|run-setup.sh|\
|
|
LIFTSHIFT-MANIFEST.md|liftshift-copy.sh|liftshift-copy2.sh|liftshift-manifest|\
|
|
tsgcap1.txt|localpmo2.txt|localpmo3.txt|localpmo-after.txt|localpmo-boot.txt|\
|
|
crushboot.txt|crushafter.txt|crushafter2.txt|hb1.txt|hb2.txt|yolotest.log|\
|
|
tsgpmo2.txt|tsgpmo3.txt|tsgpmo-after.txt|tsgpmo-boot.txt|\
|
|
pmo-before.txt|pmo-after.txt|pmo-yolo.txt|\
|
|
work-before.txt|work-after.txt|work-screen.txt|work-screen2.txt|work-yolo.txt|\
|
|
bodw2.txt|cco-pmo.txt|cco-work2.txt|\
|
|
TSGBOD-pmo.txt|TSGBOD-work.txt|TSGCCO-pmo.txt|TSGCTO-pmo.txt|TSGCTO-work.txt|\
|
|
CTOHandoff.md|COO-PMO-RESUME.md|human-feed-hud.txt|\
|
|
offstage-kit|cos-pkg|cos-pkg-v2|\
|
|
w.sh|w1.sh|tl.sh|logs.sh|fix.sh|verify.sh|restart.sh|provision.sh|dbg.sh|\
|
|
inspect.sh|inspect-body.sh|inspect-wrap.sh|\
|
|
install-unit.sh|install-body.sh|final2.sh|final-check.sh|final-topology.sh|\
|
|
ssh-diag.sh|wrapper-extract.sh|w-extract.sh) return 0 ;;
|
|
*) return 1 ;;
|
|
esac
|
|
}
|
|
|
|
for d in /home/_crossfeed/coo "$META_ROOT" "$COO_ROOT"; do
|
|
[ -d "$(dirname "$d")" ] || { echo "ERROR: missing $d"; exit 1; }
|
|
done
|
|
|
|
if [ "$DRY" -eq 0 ]; then
|
|
mkdir -p "$META_DEST" "$COO_DEST"
|
|
fi
|
|
META_MANIFEST="${META_DEST:-/tmp}/MANIFEST.txt"; COO_MANIFEST="${COO_DEST:-/tmp}/MANIFEST.txt"
|
|
[ "$DRY" -eq 1 ] && { META_MANIFEST=/dev/null; COO_MANIFEST=/dev/null; }
|
|
|
|
meta_n=0; coo_n=0; sys_n=0
|
|
for f in "$SRC"/* "$SRC"/.[!.]*; do
|
|
[ -e "$f" ] || continue
|
|
name=$(basename "$f")
|
|
if is_system "$name"; then
|
|
echo "SKIP(system) $name"; sys_n=$((sys_n+1)); continue
|
|
fi
|
|
meta=$(stat -c '%U:%G:%s:%y' "$f")
|
|
if is_meta "$name"; then
|
|
printf '%s|%s\n' "$name" "$meta" >> "$META_MANIFEST"
|
|
echo "META $name ($meta)"
|
|
[ "$DRY" -eq 0 ] && mv -- "$f" "$META_DEST/"
|
|
meta_n=$((meta_n+1))
|
|
else
|
|
printf '%s|%s\n' "$name" "$meta" >> "$COO_MANIFEST"
|
|
echo "COO $name ($meta)"
|
|
[ "$DRY" -eq 0 ] && mv -- "$f" "$COO_DEST/"
|
|
coo_n=$((coo_n+1))
|
|
fi
|
|
done
|
|
|
|
if [ "$DRY" -eq 0 ]; then
|
|
chgrp -R users "$META_ROOT" "$COO_ROOT"
|
|
chmod -R g+rX "$META_ROOT" "$COO_ROOT"
|
|
echo "DONE: meta=$meta_n -> $META_DEST | coo=$coo_n -> $COO_DEST | skipped(system)=$sys_n"
|
|
else
|
|
echo "DRY RUN: meta=$meta_n coo=$coo_n skipped=$sys_n — nothing moved"
|
|
fi
|