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