#!/bin/bash mkdir -p /run/dbus dbus-daemon --system --fork 2>/dev/null || true export PATH=$PATH:/usr/local/bin # OpenClaw config mkdir -p ~/.config/openclaw cat > ~/.config/openclaw/config.json << 'EOF' { "gateway": { "mode": "local", "port": 9000, "bind": "lan" } } EOF echo "=== Starting OpenClaw Gateway (background) ===" while true; do openclaw gateway --port 9000 --bind lan --allow-unconfigured sleep 10 done & sleep 5 echo "=== Starting ttyd terminal ===" ttyd \ --port 8080 \ --interface 127.0.0.1 \ --writable \ bash & TTYD_PID=$! sleep 3 echo "=== Starting nginx ===" nginx -g "daemon off;" & NGINX_PID=$! echo " ✅ Terminal: your-space.hf.space/ 🤖 OpenClaw: port 9000 (background) " # Keep alive while true; do if ! kill -0 $TTYD_PID 2>/dev/null; then ttyd --port 8080 --interface 127.0.0.1 --writable bash & TTYD_PID=$! fi if ! kill -0 $NGINX_PID 2>/dev/null; then nginx -g "daemon off;" & NGINX_PID=$! fi sleep 10 done