The script will test for the existence of a symlink from /.vnc, and the existence of the password file /.vnc/passwd.
Starting x11vnc from the command line the password file is located at ~/.vnc/passwd, but starting it from /etc/init.d/ it is looking for the password file at /.vnc/passwd
(there are other solutions, just didn't look further. Probably the one of the many parameters can solve this too: http://www.karlrunge.com/x11vnc/x11vnc_opts.html )
Create a symlink to /root/.vnc
Code: Select all
ln -s /root/.vnc /.vnc
Code: Select all
#!/bin/sh
#
# Start the server, with ssl support, VeNCrypt, and standard VNC password authentication.
# Accept multiple clients simultaneously. Run quietly, in the background.
#
# http://www.karlrunge.com/x11vnc/x11vnc_opts.html
#
# add to startup sequence with: /usr/sbin/update-rc.d -v x11vnc start 60 5 . stop 60 0 1 6 .
DAEMON=/usr/bin/x11vnc-bin
DAEMON_NAME=x11vnc-bin
PasswDir=/.vnc
PasswFile=/.vnc/passwd
test -x $DAEMON || exit 0
start_x11vnc () {
if [ -L $PasswDir ] && [ -d $PasswDir ]; then
if [ -e $PasswFile ]; then
$DAEMON -shared \
-rawfb map:/dev/fb0@800x480x32 \
-forever \
-pipeinput UINPUT:touch,touch_always=1,abs,pressure=128,tslib_cal=/etc/pointercal,direct_abs=/dev/input/event0,direct_btn=/dev/input/event0,direct_rel=/dev/input/event0,direct_key=/dev/input/event0,nouinput \
-cursor arrow \
-ssl SAVE -vencrypt nodh:plain:support -usepw \
-quiet -bg
else
echo -e \n
echo "The password file doesn't exist yet. Create one before using the startup script."
fi
else
echo -e \n
echo "a symlink from /.vnc to /root/.vnc seems to be missing. Add it with 'ln -s /root/.vnc /.vnc' "
fi
}
stop_x11vnc () {
killall $DAEMON_NAME
}
case "$1" in
start)
echo -n "Starting x11vnc"
start_x11vnc
;;
stop)
echo -n "Stopping x11vnc"
stop_x11vnc
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}" >&2
exit 1
;;
esac
exit 0
Code: Select all
chmod +x /etc/init.d/x11vnc
Code: Select all
/usr/sbin/update-rc.d -v x11vnc start 60 5 . stop 60 0 1 6 .
Code: Select all
/etc/init.d/x11vnc {start|stop|restart}
e.g:
/etc/init.d/x11vnc start
Code: Select all
sh -x /etc/init.d/x11vnc {start|stop|restart}
Note:
If the toon gets stuck while booting up, it is probably waiting for a password to be entered via the console.
Dropbear should have started already, so you can correct this by removing the startup of the scrip with:
Code: Select all
/usr/sbin/update-rc.d -v -f x11vnc remove