feat(tools): rppclock 守候重试包装

This commit is contained in:
agent committed 2026-07-29 06:58:01 +00:00
1 parent 5646c0a327
commit 29e4c2b10c
1 file changed
+17
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# rppclock: 守候重试包装——每条命令重试至 ok 或 8 次(跨设备睡眠窗口)
# 用法: rppclock.sh <label> -- <ppclock args...>
set -u
LABEL="$1"; shift; shift # 去掉 '--'
export PPCLOCK_VIA="${PPCLOCK_VIA:-bridge://192.168.61.35:8971}"
cd /mnt/documents/Works/Eink/qianbian
for i in 1 2 3 4 5 6 7 8; do
out=$(.venv/bin/ppclock --json --mac 18:BC:5A:5D:BF:28 --timeout 40 "$@" 2>&1 | tail -1)
if echo "$out" | grep -q '"ok": true'; then
echo "✅ $LABEL (第${i}次) $out"
exit 0
fi
sleep 12
done
echo "❌ $LABEL 8次未成功: $out"
exit 1