#!/bin/sh # 480s side, Test D: wait for the NEW boot's NCM, then at once push b10b3-mon.sh to the board and start it (5 s, EVDD=04/00, VMAX 4.15 V), # then start the 30-s pull into logs/b10/b10b3/-mon.txt. Board side reads only (writes /tmp only). usage: b10b3b-mon-start.sh K K=$1; [ -n "$K" ] || { echo "usage: $0 K"; exit 2; } cd ~/doc/modem/jz08-aurora; A=logs/b10/b10b3/$K-actions.txt; act() { echo "$(date -u +%H:%M:%S.%3N) $*" | tee -a $A; } rm -f logs/b10/b10b3/pull.stop act "mon-start $K: waiting for the board to go away (warm reboot)"; until ! ping -c1 -W1 172.16.42.1 >/dev/null 2>&1; do sleep 0.5; done; act "board gone" until ping -c1 -W1 172.16.42.1 >/dev/null 2>&1; do sleep 0.5; done; act "NCM up" i=0; until { sleep 1; printf 'nc -l -p 9943 > /tmp/b10b3-mon.sh &\r\n'; sleep 1; } | ncat -w 4 172.16.42.1 23 >/dev/null 2>&1; do i=$((i+1)); [ $i -ge 60 ] && { act "ABORT: no telnet"; exit 1; }; sleep 1; done sleep 1; ncat --send-only 172.16.42.1 9943 < b10/b10b3/b10b3-mon.sh; sleep 1 sh b10/b10b3/b10b3-cmd.sh 3 'md5sum /tmp/b10b3-mon.sh; rm -f /tmp/b10b3-mon.stop; VMAX=4150000 EVDD=04 EVDD2=00 setsid sh /tmp/b10b3-mon.sh 5 > /dev/null 2>&1 < /dev/null & sleep 1; dmesg | grep -E "safety timer|supervisor"; cut -d" " -f1 /proc/uptime' | tee -a $A act "local md5 $(md5sum < b10/b10b3/b10b3-mon.sh)" setsid nohup sh b10/b10b3/b10b3-pull.sh $K > /dev/null 2>&1 < /dev/null & act "monitor started (5 s), pull started -> logs/b10/b10b3/$K-mon.txt"