添加VNC开机启动

时间:2024-03-29 09:19:31

1、添加开机启动文件        sudo nano /etc/init.d/tightvncserver

2、添加文件内容

  • #!/bin/sh

  • ### BEGIN INIT INFO

  • # Provides: tightvncserver

  • # Required-Start: $syslog $remote_fs $network

  • # Required-Stop: $syslog $remote_fs $network

  • # Default-Start: 2 3 4 5

  • # Default-Stop: 0 1 6

  • # Short-Description: Starts VNC Server on system start.

  • # Description: Starts tight VNC Server. Script written by James Swineson.

  • ### END INIT INFO

  • # /etc/init.d/tightvncserver

  • VNCUSER='pi'

  • case "$1" in

  • start)

  • su $VNCUSER -c '/usr/bin/tightvncserver :1'

  • echo "Starting TightVNC Server for $VNCUSER"

  • ;;

  • stop)

  • pkill Xtightvnc

  • echo "TightVNC Server stopped"

  • ;;

  • *)

  • echo "Usage: /etc/init.d/tightvncserver {start|stop}"

  • exit 1

  • ;;

  • esac

  • exit 0

  • 添加VNC开机启动
  •  
  •  
  • 3、修改问价权限
  • sudo chmod 755 /etc/init.d/tightvncserver

4、添加更新开机启动配置

sudo update-rc.d tightvncserver defaults

 

5、取消开机重启    sudo update-rc.d -f tightvncserver remove