|
Softpanorama |
||||||
| Contents | Bulletin | Latest | Last year | Top visited | Scriptorama | |
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
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
The names bob, sally and jim are usernames. Modify accordingly. The---------------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-2012 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. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine. This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...
Disclaimer:
Last modified: August 14, 2009