#!/bin/sh # 480s side, production-profile run: wait for the NEW boot's NCM, then at once push b10b3-mon.sh to the board and start it (5 s, EVDD=08/02, VMAX 4.23 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 lk1st fastboot (RESET-held reboot), then for the new boot"; until fastboot devices 2>/dev/null | grep -q ; do sleep 1; done; act "fastboot seen"; until ! fastboot devices 2>/dev/null | grep -q ; do sleep 1; done; act "fastboot gone (booting)" 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 9981 > /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 9981 < 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=4230000 EVDD=08 EVDD2=02 setsid sh /tmp/b10b3-mon.sh 30 > /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 (30 s), pull started -> logs/b10/b10b3/$K-mon.txt"