#!/usr/bin/env bash # Container entrypoint: supervised inspire_g1 + hand_bridge + Flask dashboard. set -u cd /opt/hand export HAND_REPO=/opt/hand IFACE="${IFACE:-eth0}" echo "[inspire-hand] iface=$IFACE ttyUSB: $(ls /dev/ttyUSB* 2>/dev/null | tr '\n' ' ')" # Supervisor: (re)start inspire_g1 whenever the CH340 adapters are present but the # service isn't running. Self-heals across the flaky-hub disconnect/reconnect cycles. ( while true; do if ! pgrep -x inspire_g1 >/dev/null 2>&1; then if ls /dev/ttyUSB* >/dev/null 2>&1; then echo "[supervisor] adapters present, starting inspire_g1: $(ls /dev/ttyUSB* | tr '\n' ' ')" ./build/inspire_g1 >/tmp/inspire_g1.log 2>&1 & sleep 2 sed 's/^/[inspire_g1] /' /tmp/inspire_g1.log fi fi sleep 3 done ) & # TCP->DDS bridge for the dashboard (stays up regardless; commands no-op if service down) setsid ./build/hand_bridge "$IFACE" 7799 >/tmp/hand_bridge.log 2>&1 /dev/null | grep -vc arm_home) takes)" else echo "[inspire-hand] recorder: NOT in image — record/replay panel disabled" fi echo "[inspire-hand] dashboard on :8088" exec python3 web/hand_web.py --port 8088