|
Softpanorama |
May the source be with you, but remember the KISS principle ;-)
|
vncrc, unix rc scripts for VNC
make two symbolic links to this file /etc/rc.d/rc.5/S92vnc ->
/etc/rc.d/init.d/vnc
and /etc/rc.d/rc.5/K36vnc -> /etc/rc.d/init.d/vnc
K36vnc stops the vnc service at shutdown or reboot, and S92vnc will start the
vnc server when entering runlevel 5.
KSH:
same here symbolic links from init.d/vnc to /etc/rc2.d/S99vnc.
#!/bin/sh
# sunos/solaris rc script to run userbased vnc server
# written by: Shay Hugi, systemunix@mpthrill.com
# writing style: [i]nteractive shellscript
# tested on platform environment: Sun/OS 5.7
# proccess name: vncserver
#
# Source function library.
. /etc/rc.d/init.d/functions
RETVAL=0
# See how we were called.
case "$1" in
start)
echo -n "Starting VNC services for user shay: "
# Just in case a lock file was left behind,
# remove it now.
/bin/rm /tmp/.X1-lock
su -l -c "/usr/local/bin/vncserver -name mpthrill.com_solaris_vnc -cc 3 -geometry 1024x768 :1 " shay
RETVAL=$?
;;
stop)
echo -n "Shutting down VNC services: "
su -l -c "/usr/local/bin/vncserver -kill :1 " shay
RETVAL=$?
;;
restart)
$0 stop
$0 start
RETVAL=$?
;;
status)
#status commands
echo "check status by user? [y/n]:"
read csbu
if [ $csbu = y -o $csbu = Y ]; then
echo "who is the user?:"
read witu
ps -ef | grep Xvnc | grep $witu
else
ps -ef | grep Xvnc
fi
;;
help)
$0 readhelp | more
;;
readhelp)
echo " general"
echo " "
echo " a user based vnc rc script for the sunos/solaris.
echo " "
echo " install"
echo " "
echo " make two symbolic links to this file :"
echo " /etc/rc.d/rc.5/S92vnc -> /etc/rc.d/init.d/vnc"
echo " and /etc/rc.d/rc.5/K36vnc -> /etc/rc.d/init.d/vnc"
echo " K36vnc stops the vnc service at shutdown or reboot"
echo " and S92vnc will start the vnc server when entering runlevel 5."
echo " "
echo " commands help"
echo " "
echo " stop: will only stop the main system's vnc proccess"
echo " "
echo " start: will start a vnc desktop for the user who ran the shell"
echo " "
echo " stopid: will interactively stop the vnc service by :desktop number"
echo " per each user who ran the script"
echo " "
echo " status: will interactively show the the current status of vnc"
echo " you can choose between specific user or all users"
echo " provides: pid and desktop number"
echo " "
echo " help: this help guide dahhh"
echo " "
echo " "
echo " ***final notes***"
echo " you may want to set your path and the begining of the script"
echo " and the name of the desktop the script creates"
echo " also to enable debugging and view on each desktop while running"
echo " the script, delete the [2>&1] at the end of each [>dev/null]"
echo " "
echo " for more help: http://www.uk.research.att.com/vnc"
echo " or email me: systemunix@mpthrill.com "
echo " "
;;
*)
echo "Usage: $0 [ start | status | stop | restart | help ]"
exit 1
;;
esac
exit $RETVAL
Running Xvnc as daemon at Solaris Boot - FOLLOWUP
---------------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--------------------
Copyright © 1996-2008 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
Standard disclaimer: The statements, views and opinions presented on this web page are those of the author and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.
Last modified: February 28, 2008