Tinker Board Forum

Full Version: How configure tightvnc to run programs?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
After the vnc server is started, the program Windows are not displayed although the program process is running. Probably the problem is that they can't capture the display. How can fix it?

Presumably the code section to run vnc in tinker-config file:

Code:
get_vnc(){
 if [ -e /lib/systemd/system/tightvncserver.service ]; then
   if systemctl status tightvncserver.service | grep -q -E "enabled;"; then
     echo 0
   else
     echo 1
   fi
 else
   echo 1
 fi
}

set_vnc_passwd() {
 if [ ! -e /home/linaro/.vnc ]; then
   sudo -i -u linaro mkdir /home/linaro/.vnc
 fi
 if [ ! -e /home/linaro/.vnc/passwd ]; then
   sudo -i -u linaro touch /home/linaro/.vnc/passwd
   chmod 600 /home/linaro/.vnc/passwd
 fi
 sudo -i -u linaro vncpasswd -f <<< $1 > /home/linaro/.vnc/passwd
}

do_vnc() {
 DEFAULT=--defaultno
 if [ $(get_vnc) -eq 0 ]; then
   DEFAULT=
 fi
 if [ "$INTERACTIVE" = True ]; then
   whiptail --yesno "Would you like to automatically start the VNC server at boot?" $DEFAULT 20 60 2
   RET=$?
 else
   RET=$1
 fi
 if [ $RET -eq 0 ]; then
   if [ ! -d /usr/share/doc/tightvncserver ] ; then
     if [ "$INTERACTIVE" = True ]; then
       whiptail --msgbox "tightvncserver is not installed" 20 60 1
     fi
     return 1
   fi
   if [ "$INTERACTIVE" = True ]; then
     whiptail --msgbox "You will now be asked to enter a password for VNC server" 20 60 2
     sudo -i -u linaro vncpasswd
   fi
   if [ -e /lib/systemd/system/tightvncserver.service ]; then
     sudo systemctl stop tightvncserver.service
     sudo systemctl disable tightvncserver.service
     sudo rm /lib/systemd/system/tightvncserver.service
   fi
   cat > /lib/systemd/system/tightvncserver.service << EOF
[Unit]
Description=TightVNC Server
After=sshd.service network.target

[Service]
Type=forking
User=linaro
ExecStartPre=-/usr/bin/tightvncserver -kill :1 > /dev/null 2>&1
ExecStart=/usr/bin/tightvncserver :1
ExecStop=/usr/bin/tightvncserver -kill :1
[Install]
WantedBy=multi-user.target
EOF
   sudo systemctl daemon-reload
   sudo systemctl start tightvncserver.service
   sudo systemctl enable tightvncserver.service
   VNC_BOOT_STATUS=enabled
 elif [ $RET -eq 1 ]; then
   if [ -e /lib/systemd/system/tightvncserver.service ]; then
     sudo systemctl stop tightvncserver.service
     sudo systemctl disable tightvncserver.service
     sudo rm /lib/systemd/system/tightvncserver.service
     sudo systemctl daemon-reload
   fi
   VNC_BOOT_STATUS=disabled
 else
   return $RET
 fi
 if [ "$INTERACTIVE" = True ]; then
   whiptail --msgbox "Starting VNC server at boot is $VNC_BOOT_STATUS" 20 60 1
 fi
}