feat: working XFCE + RustDesk online on VPS tmux

- Add start-rd-desktop.sh: Xvfb :99 + xfwm4 + xfce4-panel + RustDesk client
- Add rustdesk-vps.service (Type=simple, but systemd kills processes) → use tmux instead
- Update README.md with VPS architecture (Xvfb + xfce4-session + RustDesk)
- Update VPS section: tmux persistent session instead of systemd
- RustDesk ID: 458564614, password: retrowest
- Ports 21115-21119 open in UFW for Docker server (optional)
- XFCE desktop confirmed working (xfdesktop + xfwm4 + panel)

Note: systemd ExecStartPre kills background processes (Xvfb, xfce4).
Solution: tmux detached session 'rd' with start-rd-desktop.sh
This commit is contained in:
Deploy Bot
2026-05-15 22:02:45 +01:00
parent be123e8057
commit 554aa6008d
4 changed files with 134 additions and 12 deletions

View File

@@ -0,0 +1,51 @@
#!/bin/bash
# RustDesk + XFCE Desktop Auto-Start for VPS
# Systemd runs this script; script waits for Xvfb to exit
set -e
# Kill old
pkill -9 -f rustdesk 2>/dev/null || true
pkill -9 -f xfce4-session 2>/dev/null || true
pkill -9 Xvfb 2>/dev/null || true
rm -f /tmp/.X11-unix/X99 /tmp/.X*-lock
sleep 2
# Start Xvfb :99
Xvfb :99 -screen 0 1920x1080x24 -ac +extension RANDR +extension RENDER +extension GLX > /dev/null 2>&1 &
XVFB_PID=$!
sleep 3
# Wait for display ready
export DISPLAY=:99
export XAUTHORITY=/root/.Xauthority
for i in $(seq 1 30); do
xrandr --listmonitors > /dev/null 2>&1 && break
if ! kill -0 $XVFB_PID 2>/dev/null; then
echo "ERROR: Xvfb died"
exit 1
fi
sleep 1
done
xrandr --listmonitors > /dev/null 2>&1 || { echo "ERROR: Display :99 not ready"; exit 1; }
# Start XFCE desktop in background
nohup dbus-run-session -- xfce4-session > /tmp/xfce-session.log 2>&1 &
echo "XFCE PID: $!"
sleep 5
# Wait for window manager
for i in $(seq 1 20); do
ps aux | grep xfwm4 | grep -v grep > /dev/null 2>&1 && break
sleep 1
done
# Start RustDesk client in background
nohup dbus-run-session -- /usr/share/rustdesk/rustdesk --server > /tmp/rustdesk-session.log 2>&1 &
echo "RustDesk PID: $!"
sleep 3
# Wait for Xvfb (main process) - systemd tracks this script
# If Xvfb dies, systemd will restart the service
wait $XVFB_PID