entrypoint.sh 602 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. # 1. 清理锁文件
  3. rm -f /tmp/.X99-lock
  4. # 清理 DBus 锁文件 (防止重启报错)
  5. rm -f /var/run/dbus/pid
  6. # 2. [新增] 启动 DBus 服务
  7. mkdir -p /var/run/dbus
  8. dbus-daemon --config-file=/usr/share/dbus-1/system.conf --print-address &
  9. # 3. 启动 Xvfb
  10. Xvfb :99 -ac -screen 0 1920x1080x24 -nolisten tcp &
  11. # 等待服务就绪
  12. echo "Waiting for Xvfb and DBus..."
  13. sleep 3
  14. # 4. 执行传递给容器的命令
  15. # 如果没有传命令,默认执行 python3 main_sentinel.py (为了兼容你以前的习惯)
  16. if [ $# -eq 0 ]; then
  17. exec python3 main_sentinel.py
  18. else
  19. exec "$@"
  20. fi