(this example is taken from a Solaris environment)
Here's how to setup the usual startup/stop script approach used by other
Solaris programs to get VNC to start at boot time.
First become root. Then create a file called /etc/init.d/rc.vnc with the
following content (modified appropriately, see below):
---------------start file on next line--------------------
#!/bin/sh
#
# Startup/Stop script for vncservers for some users.
#
case "$1" in
'start')
/bin/su - bob -c "/usr/local/bin/vncserver :1"
/bin/su - sally -c "/usr/local/bin/vncserver :2"
/bin/su - jim -c "/usr/local/bin/vncserver :3"
;;
'stop')
/bin/su - bob -c "/usr/local/bin/vncserver -kill :1"
/bin/su - sally -c "/usr/local/bin/vncserver -kill :2"
/bin/su - jim -c "/usr/local/bin/vncserver -kill :3"
;;
*)
echo "Usage: /etc/init.d/rc.vnc { start | stop }"
;;
esac
---------------end file on previous line--------------------
The names bob, sally and jim are usernames. Modify accordingly. The
corresponding numbers :1, :2, :3 for VNC may also need to be changed.
Make sure that /etc/init.d/rc.vnc has the correct ownership/permissions:
# chown root:other /etc/init.d/rc.vnc
# chmod 744 /etc/init.d/rc.vnc
Next create symbolic links to that file as follows:
# cd /etc/rc0.d
# ln -s ../init.d/rc.vnc K40rc.vnc
# cd /etc/rc2.d
# ln -s ../init.d/rc.vnc S99rc.vnc
That should do it. I've been doing it this way for years and it works
great for me. I'd rather not add things to inetd.conf when I don't have
to.
Thanks to Mike Miller for the Contribution! |