To download use the following commands:
wget http://www.penguintutor.com/otherfiles/tightvncserver-init.txt
sudo mv tightvncserver-init.txt /etc/init.d/tightvncserver
You may need to change the variable on line 16. It is currently set to pi which is the default username on the Raspberry Pi Debian image. Set this to whatever username you want to login to TightVNC as. Do not put root as the user.
Change the file so it is owned by root (not strictly neccessary, but is the standard ownership for init files
sudo chown root:root /etc/init.d/tightvncserver
Make the file executable by running
sudo chmod 755 /etc/init.d/tightvncserver
Add the script to the default runlevels with the command
sudo update-rc.d tightvncserver defaults
TightVNC will now start at startup. I'd recommend you reboot at this point to make sure it's working, but you can just stop and start if you don't want to reboot.
You can manually start and stop it using
sudo /etc/init.d/tightvncserver start
and
sudo /etc/init.d/tightvncserver stop
Note that this is designed for running only one instance of TightVNC on the computer. If you want to be able to start and stop specific instances of TightVNC then you will need to tweak the startup script appropriately.
Comments