#!/bin/bash
### noVNC Startup Script - Rick Prime A1

# Wait for network
sleep 2

# Start Xvfb (virtual framebuffer)
pgrep -x Xvfb || Xvfb :1 -screen 0 1920x1080x24 -ac +extension GLX +render -noreset &
sleep 1

# Start x11vnc (shares Xvfb)
pgrep -f x11vnc || x11vnc -display :1 -forever -shared -rfbport 5901 -nopw &
sleep 1

# Start websockify (VNC over WebSocket)
pgrep -f websockify || websockify --web /home/amadeus/noVNC 0.0.0.0:6080 localhost:5901 &

echo "noVNC started on http://$(hostname -I | cut -d' ' -f1):6080/vnc.html"
