This is the tightvncserver init.d script, tightvncserver, in /etc/init.d:
============
BEGIN INIT INFO
Provides: tightvncserver
Required-Start: $remote_fs $syslog
Required-Stop: $remote_fs $syslog
Default-Start: 2 3 4 5
Default-Stop: 0 1 6
Short-Description: tightvncserver starts at boot time
Description: Start tightvncserver connection service
END INIT INFO
set the USER variable for the VNC server
Note: Starting the VNC Server on :1 means we need to connect to port 5901
To install:
sudo chown root:root /etc/init.d/tightvncserver
sudo chmod 755 /etc/init.d/tightvncserver
sudo update-rc.d tightvncserver defaults
export USER=pi
export HOME=/home/pi
eval cd ~$USER
case "$1" in
start)
su - $USER -c "/usr/bin/tightvncserver -geometry 1280x720 -depth 24 /etc/init.d
:1"
echo "Starting TightVNC server for $USER"
;;
stop)
pkill Xtightvnc
echo "TightVNC server stopped"
;;
*)
echo "Usage: /etc/init.d/tightvncserver {start|stop}"
exit 1
;;
esac
exit 0
============
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: tightvncserver starts at boot time
# Description: Start tightvncserver connection service
### END INIT INFO
#
# set the USER variable for the VNC server
#
# Note: Starting the VNC Server on :1 means we need to connect to port 5901
#
# To install:
#
# sudo chown root:root /etc/init.d/tightvncserver
# sudo chmod 755 /etc/init.d/tightvncserver
# sudo update-rc.d tightvncserver defaults
#
#
export USER=pi
export HOME=/home/pi
eval cd ~$USER
case "$1" in
start)
su - $USER -c "/usr/bin/tightvncserver -geometry 1280x720 -depth 24 :1"
echo "Starting TightVNC server for $USER"
;;
stop)
pkill Xtightvnc
echo "TightVNC server stopped"
;;
*)
echo "Usage: /etc/init.d/tightvncserver {start|stop}"
exit 1
;;
esac
exit 0
============
-rwxr-xr-x 1 root root 918 Dec 13 14:02 tightvncserver
-rwxr-xr-x 1 root root 918 Dec 13 14:02 tightvncserver
sudo ./tightvncserver start
sudo ./tightvncserver start
sudo update-rc.d tightvncserver defaults
sudo update-rc.d tightvncserver defaults