微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ubuntu设置tightvncserver自动启动

vi /etc/init.d/vnc
#!/bin/bash
PATH="$PATH:/usr/bin/"
export USER="root"
disPLAY="1"
DEPTH="24"
GEOMETRY="1024x768"
OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${disPLAY} -localhost"
. /lib/lsb/init-functions


case "$1" in
 start)
 log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${disPLAY}"
 su ${USER} -c "/usr/bin/tightvncserver ${OPTIONS}"
 ;;

 stop)
 log_action_begin_msg "Stopping vncserver for user '${USER}' on localhost:${disPLAY}"
 su ${USER} -c "/usr/bin/tightvncserver -kill :${disPLAY}"
 ;;

 restart)
 $0 stop
 $0 start
 ;;

 *)
 echo "Usage: /etc/init.d/vnc (start|stop|restart)"
 exit 1
 ;;
esac

exit 0
:wq!
chmod +x /etc/init.d/vnc
update-rc.d vnc defaults
关闭vncserver
$ vncserver -kill :1
# 数字 1 为桌面号,对应客户端的端口为5901,以此类推2,3,4....

原文地址:https://www.jb51.cc/ubuntu/354099.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐