ubuntu设置tightvncserver自动启动

前端之家收集整理的这篇文章主要介绍了ubuntu设置tightvncserver自动启动前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  1. vi /etc/init.d/vnc
  2. #!/bin/bash
  3. PATH="$PATH:/usr/bin/"
  4. export USER="root"
  5. DISPLAY="1"
  6. DEPTH="24"
  7. GEOMETRY="1024x768"
  8. OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY} -localhost"
  9. . /lib/lsb/init-functions
  10. case "$1" in
  11. start)
  12. log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
  13. su ${USER} -c "/usr/bin/tightvncserver ${OPTIONS}"
  14. ;;
  15. stop)
  16. log_action_begin_msg "Stopping vncserver for user '${USER}' on localhost:${DISPLAY}"
  17. su ${USER} -c "/usr/bin/tightvncserver -kill :${DISPLAY}"
  18. ;;
  19. restart)
  20. $0 stop
  21. $0 start
  22. ;;
  23. *)
  24. echo "Usage: /etc/init.d/vnc (start|stop|restart)"
  25. exit 1
  26. ;;
  27. esac
  28. exit 0
  29. :wq!
  30. chmod +x /etc/init.d/vnc
  31. update-rc.d vnc defaults
  1. 关闭vncserver
  1. $ vncserver -kill :1
    # 数字 1 为桌面号,对应客户端的端口为5901,以此类推2,3,4....

猜你在找的Ubuntu相关文章