Spaces:
Paused
Paused
File size: 1,595 Bytes
b9a5ae8 8ec948c b9a5ae8 8ec948c b9a5ae8 8ec948c b9a5ae8 8ec948c b9a5ae8 8ec948c b9a5ae8 8ec948c b9a5ae8 8ec948c b9a5ae8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #!/bin/bash
set -euo pipefail
echo "==== Starting LXDE + Firefox + noVNC + cloudflared ===="
# عرض الإعدادات
echo "DISPLAY=${DISPLAY}"
echo "VNC password file=/root/.vnc/passwd"
echo "Resolution=${GEOMETRY}"
echo "noVNC port=${NOVNC_PORT}"
export DISPLAY=:1
# تشغيل الشاشة الوهمية Xvfb
Xvfb :1 -screen 0 ${GEOMETRY}x16 2>&1 | tee /proc/1/fd/1 &
XVFB_PID=$!
echo "Started Xvfb (PID $XVFB_PID)"
# تشغيل dbus
if ! pgrep -x dbus-daemon >/dev/null 2>&1; then
dbus-daemon --session --fork --print-address > /tmp/dbus_address || true
echo "Started dbus-daemon"
fi
# تشغيل Firefox
firefox 2>&1 | tee /proc/1/fd/1 &
FIREFOX_PID=$!
echo "Started Firefox (PID $FIREFOX_PID)"
# تشغيل x11vnc مع كلمة مرور
x11vnc -display :1 -forever -usepw -shared 2>&1 | tee /proc/1/fd/1 &
X11VNC_PID=$!
echo "Started x11vnc (PID $X11VNC_PID)"
# تشغيل noVNC proxy
python3 /opt/novnc/utils/novnc_proxy --vnc localhost:5900 --listen ${NOVNC_PORT} 2>&1 | tee /proc/1/fd/1 &
NOVNC_PID=$!
echo "Started noVNC (PID $NOVNC_PID) at http://localhost:${NOVNC_PORT}/vnc.html"
# تشغيل cloudflared مع إعادة التشغيل التلقائية
restart_cloudflared() {
while true; do
echo "Starting cloudflared tunnel..."
cloudflared tunnel --url http://localhost:${NOVNC_PORT} --no-autoupdate 2>&1 | tee /proc/1/fd/1
echo "cloudflared crashed. Restarting in 5 seconds..."
sleep 5
done
}
restart_cloudflared &
# إبقاء الحاوية تعمل للأبد (يمكن الاحتفاظ بها)
tail -f /dev/null |