Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion scripts/nemoclaw-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ while time.time() < DEADLINE:
else:
print(f'[auto-pair] watcher timed out approvals={APPROVED}')
PYAUTOPAIR
echo "[gateway] auto-pair watcher launched (pid $!)"
AUTO_PAIR_PID=$!
echo "[gateway] auto-pair watcher launched (pid $AUTO_PAIR_PID)"
}

# ── Main ─────────────────────────────────────────────────────────
Expand Down Expand Up @@ -242,6 +243,17 @@ if [ "$(id -u)" -ne 0 ]; then
echo "[gateway] openclaw gateway launched (pid $GATEWAY_PID)"
start_auto_pair
print_dashboard_urls

# Forward SIGTERM/SIGINT to child processes for graceful shutdown.
# This script is PID 1 — without a trap, signals interrupt wait and
# children are orphaned until Docker sends SIGKILL after the grace period.
cleanup() {
echo "[gateway] received signal, forwarding to children..."
kill -TERM "$GATEWAY_PID" "${AUTO_PAIR_PID:-}" 2>/dev/null
wait "$GATEWAY_PID" 2>/dev/null
}
trap cleanup SIGTERM SIGINT

wait "$GATEWAY_PID"
exit $?
fi
Expand Down Expand Up @@ -293,6 +305,16 @@ echo "[gateway] openclaw gateway launched as 'gateway' user (pid $GATEWAY_PID)"
start_auto_pair
print_dashboard_urls

# Forward SIGTERM/SIGINT to child processes for graceful shutdown.
# This script is PID 1 — without a trap, signals interrupt wait and
# children are orphaned until Docker sends SIGKILL after the grace period.
cleanup() {
echo "[gateway] received signal, forwarding to children..."
kill -TERM "$GATEWAY_PID" "${AUTO_PAIR_PID:-}" 2>/dev/null
wait "$GATEWAY_PID" 2>/dev/null
}
trap cleanup SIGTERM SIGINT

# Keep container running by waiting on the gateway process.
# This script is PID 1 (ENTRYPOINT); if it exits, Docker kills all children.
wait "$GATEWAY_PID"