entrypoint.sh 511 B

123456789101112131415161718192021
  1. #!/bin/bash
  2. # 1. 清理锁文件
  3. rm -f /tmp/.X99-lock
  4. # 清理 DBus 锁文件 (防止重启报错)
  5. rm -f /var/run/dbus/pid
  6. # 2. [新增] 启动 DBus 服务
  7. # 这解决了 Failed to connect to socket /run/dbus/system_bus_socket 错误
  8. mkdir -p /var/run/dbus
  9. dbus-daemon --config-file=/usr/share/dbus-1/system.conf --print-address &
  10. # 3. 启动 Xvfb
  11. Xvfb :99 -ac -screen 0 1920x1080x24 -nolisten tcp &
  12. # 等待服务就绪
  13. echo "Waiting for Xvfb and DBus..."
  14. sleep 3
  15. # 4. 启动 Python
  16. python3 main_server.py