2017-09-04 23:11:28
http://bbs.elecfans.com/forum.php?mod=viewthread&tid=583803&extra=
#!/bin/sh
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop tightvncserver
### END INIT INFO
# More details see:
# http://www.penguintutor.com/linux/tightvnc
### Customize this entry
# Set the USER variable to the name of the user to start tightvncserver under
export USER='pi'
### End customization required
eval cd ~$USER
case "$1" in
start)
# 启动命令行。此处自定义分辨率、控制台号码或其它参数。
su $USER -c '/usr/bin/tightvncserver -depth 16 -geometry 800x600 :1'
echo "Starting TightVNC server for $USER "
;;
stop)
# 终止命令行。此处控制台号码与启动一致。
su $USER -c '/usr/bin/tightvncserver -kill :1'
echo "Tightvncserver stopped"
;;
*)
echo "Usage: /etc/init.d/tightvncserver {start|stop}"
exit 1
;;
esac
exit 0
sudo chmod 755 /etc/init.d/tightvncserver
电脑登录VNC
下载Windows客户端RealVNC Viewer。
登录地址输入“IP地址:控制台号码”,0号控制台可不加号码。
也可使用Android版VNC客户端,下载地址:http://android.d.cn/software/19334.html
使用此命令手工启动VNC服务器程序:
vncserver -geometry 800x600 :1