Files
RDtop/scripts/vps/start-rustdesk-xvfb.sh

57 lines
1.6 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# RustDesk VPS - запуск с Xvfb + xcompmgr для корректного GUI рендеринга
export DISPLAY=:0
export XAUTHORITY=/root/.Xauthority
export LIBGL_ALWAYS_SOFTWARE=1
export LIBVA_DRIVER_NAME=none
export VDPAU_DRIVER=none
# 1. Очищаем старые сессии
pkill -f Xvfb
pkill -f rustdesk
sleep 1
rm -f /tmp/.X11-unix/X0 /tmp/.X0-lock 2>/dev/null
# 2. Запускаем Xvfb с COMPOSITE extension
echo "Starting Xvfb..."
/usr/bin/Xvfb :0 -screen 0 1920x1080x24 +extension GLX +extension RANDR +extension RENDER +extension COMPOSITE -ac &
echo "Xvfb PID: $!"
sleep 2
# 3. Проверяем запуск Xvfb
if ! pgrep -f "Xvfb :0" >/dev/null; then
echo "ERROR: Xvfb failed to start"
exit 1
fi
echo "Xvfb OK"
# 4. Запускаем композитор
echo "Starting xcompmgr..."
if command -v xcompmgr >/dev/null 2>&1; then
/usr/bin/xcompmgr -d :0 &
else
echo "WARNING: xcompmgr not found. Install with: apt-get install -y xcompmgr"
fi
# 5. Настраиваем xauth
xauth -f "$XAUTHORITY" add :0 . $(mcookie) 2>/dev/null || true
chmod 600 "$XAUTHORITY"
# 6. Пишем конфиг
/root/write-rustdesk-config.sh
# 7. Запускаем RustDesk
echo "Starting RustDesk..."
nohup /usr/share/rustdesk/rustdesk &
sleep 5
echo "=== Status ==="
echo "Xvfb: $(pgrep -a Xvfb | grep :0 || echo 'NOT RUNNING')"
echo "RustDesk:"
pgrep -a rustdesk || echo 'NOT RUNNING'
echo ""
echo "RustDesk ID: $(/usr/share/rustdesk/rustdesk --get-id 2>/dev/null || echo 'N/A')"
echo ""
echo "To connect to host: rustdesk <host-id>"