running x11vnc automatically

hi all.

i have trouble getting x11vnc to run automacically while system start. I have created a script in

/etc/init.d

and activated it via

/sbin/chkconfig myscript on

. That works. Just for reference, here’s the script:


#!/bin/sh
### BEGIN INIT INFO
# Provides:          myvnc
# Required-Start:    $syslog $remote_fs
# Should-Start: $time ypbind smtp
# Required-Stop:     $syslog $remote_fs
# Should-Stop: $time ypbind smtp
# Default-Start:     5
# Default-Stop:      0 1 2 6
# Short-Description: start x11vnc on startup
# Description:       start x11vnc on startup
### END INIT INFO

case "$1" in
    start)
	echo -n "Starting myvnc "
	## Start daemon with startproc(8). If this fails
	## the return value is set appropriately by startproc.
	/sbin/startproc /usr/bin/X11/x11vnc -ncache -display :0 

	;;
    *)
	echo "Usage: $0 {start}"
	exit 1
	;;
esac

But I get an error from x11vnc itself:


23/12/2008 13:38:31 ***************************************
23/12/2008 13:38:31 *** XOpenDisplay failed (:0)

*** x11vnc was unable to open the X DISPLAY: ":0", it cannot continue.

I’m new to this *nix stuff and don’t know what to do next to solve this. Someone got a cluebat?

Thanks for reading.