I use the following scripts on Red Hat. The vncservers file goes in /etc/sysconfig and defines the vnc sessions to auto-start and on what displays. The vncserver script goes in /etc/init.d If your system supports "chkconfig", then you can simply run "chkconfig --level 35 vncserver on" to have the script automatically execute at bootup.
Audsin dev wrote: >Hi > >I need to start vnc server while the linux system >boots and make it listen to a specific port (say >1000). I usually start my vncserver with command >vncserver -rfbport 1000. > >It would be great if anyone can let me know how to >start the vnc and make it to listen to a specific port >(say 1000) while the system boots up. > >i created a file /sbin/vnc-start with the content >vncserver -rfbport 1000 and added a line >/sbin/vnc-start in the /etc/rc.local; but it doesnt >start the vncserver. > >Any suggestions how to start the vnc server during the >boot up process and make it listen to an user defined >port > >Regards >Dev > > >__________________________________________________ >Do You Yahoo!? >Tired of spam? Yahoo! Mail has the best spam protection around >http://mail.yahoo.com >_______________________________________________ >VNC-List mailing list >[email protected] >To remove yourself from the list visit: >http://www.realvnc.com/mailman/listinfo/vnc-list # The VNCSERVERS variable is a list of display:user pairs. # # Uncomment the line below to start a VNC server on display :1 # as my 'myusername' (adjust this to your own). You will also # need to set a VNC password; run 'man vncpasswd' to see how # to do that. # # DO NOT RUN THIS SERVICE if your local area network is # untrusted! For a secure way of using VNC, see # <URL:http://www.uk.research.att.com/vnc/sshvnc.html>. VNCSERVERS="1:user1 2:user2" #!/bin/bash # # chkconfig: - 91 35 # description: Starts and stops vncserver. \ # used to provide remote X administration services. # Source function library. . /etc/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 VNCSERVERS="" [ -f /etc/sysconfig/vncservers ] && . /etc/sysconfig/vncservers prog=$"VNC server" start() { echo -n $"Starting $prog: " ulimit -S -c 0 >/dev/null 2>&1 RETVAL=0 for display in ${VNCSERVERS} do echo -n "${display} " unset BASH_ENV ENV GEOM="1024x768" initlog $INITLOG_ARGS -c \ "su ${display##*:} -c \"cd ~${display##*:} && [ -f .vnc/passwd ] && vncserver :${display%%:*} -alwaysshared -depth 24 -geometry ${GEOM}\"" RETVAL=$? [ "$RETVAL" -ne 0 ] && break done [ "$RETVAL" -eq 0 ] && success $"vncserver startup" || \ failure $"vncserver start" echo [ "$RETVAL" -eq 0 ] && touch /var/lock/subsys/vncserver } stop() { echo -n $"Shutting down $prog: " for display in ${VNCSERVERS} do echo -n "${display} " unset BASH_ENV ENV initlog $INITLOG_ARGS -c \ "su ${display##*:} -c \"vncserver -kill :${display%%:*}\" >/dev/null 2>&1" done RETVAL=$? [ "$RETVAL" -eq 0 ] && success $"vncserver shutdown" || \ failure $"vncserver shutdown" echo [ "$RETVAL" -eq 0 ] && rm -f /var/lock/subsys/vncserver } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|reload) stop start ;; condrestart) if [ -f /var/lock/subsys/vncserver ]; then stop start fi ;; status) status Xvnc ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac _______________________________________________ VNC-List mailing list [email protected] To remove yourself from the list visit: http://www.realvnc.com/mailman/listinfo/vnc-list
