# cat /etc/init.d/vras-vradmind.sh #!/bin/sh # $Id: skel.vras.sh,v 2.23 2006/04/20 16:48:00 ddang Exp $ #ident "$Source: /project/vras-cvs/src/sol/cmd/vras/init.d/skel.vras.sh,v $ $Rev ision: 2.23 $" # # $Copyright: Copyright (c) 2006 Symantec Corporation. # All rights reserved. # # THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE SECRETS OF # SYMANTEC CORPORATION. USE, DISCLOSURE OR REPRODUCTION IS PROHIBITED # WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SYMANTEC CORPORATION. # # The Licensed Software and Documentation are deemed to be "commercial # computer software" and "commercial computer software documentation" # as defined in FAR Sections 12.212 and DFARS Section 227.7202. $ # PATH=/usr/lib/vxvm/bin/:$PATH # Volume Replicator Administrative Services (VRAS) Daemon Script # start up / shut down vradmind daemon # Starts vradmind daemon only if VVR license is installed if [ ! -d /usr/sbin ] then # /usr not mounted echo "/usr not mounted" exit fi . ${VOLADM_LIB:-/usr/lib/vxvm/voladm.d/lib}/vxadm_lib.sh progname=$0 daemon="vradmind" # Set the locale information for message localization. This # function can be used at boot time or called by other # commands in user space (such as vxinstall.) At boot time # we do not want localized messages, so we check for an # environment variable to see when we are called. The variable # will not exist at boot time. OLC_MESSAGES=LC_MESSAGES export OLC_MESSAGES if [ $L10N_CMD ] then # L10N_CMD exists and is set to require localized # messages. if [ $L10N_CMD = 1 ] then LC_MESSAGES=C export LC_MESSAGES fi else # L10N_CMD does not exist (or could be set to NULL) # Assume we are booting the system and no localized # messages are required. LC_MESSAGES=C export LC_MESSAGES fi # # All environment variables used by vradmind are defined in this file # ENVFILE=/etc/vx/vras/vras_env findproc() { # return pid of the named process(es) pid=`/usr/bin/ps -e -o pid,comm | /usr/bin/grep "$1" | /usr/bin/grep -v grep | /usr/bin/awk '{ print $1 }'` } findproc2() { # return pid of the named process(es) pid=`/usr/bin/ps -ef | /usr/bin/grep "$1" | /usr/bin/grep -v grep | /usr/bin/awk '{ print $2 }'` } check_vvr_license() { # return 0 if has vvr license # and return 1 otherwise /sbin/vxlictest -n "VERITAS Volume Manager" -f "VVR" >/dev/null 2>&1 if [ "$?" -eq 0 ]; then return 0 else return 1 fi } case "$1" in 'start') # check for vvr license check_vvr_license; if [ "$?" -eq 1 ]; then exit 1 fi # make sure file install-db does not exist if [ -f /etc/vx/reconfig.d/state.d/install-db ]; then # export daemon; ugettxt -n "VVR" -s "INFO" \ # "VM installation not complete; $daemon not started." vra s.mesg:2410 exit 1 fi # check if vradmind is already running start_vradmind=1 findproc vradmind; if [ "X$pid" != "X" ]; then start_vradmind=0 fi # check if vvr_stats is already running start_stats=1 findproc2 vvr_stats; if [ "X$pid" != "X" ]; then start_stats=0 fi if [ "$start_vradmind" -eq 1 ]; then # source the environment variables defined in ENVFILE if [ -f ${ENVFILE} ]; then . ${ENVFILE} fi # start vradmind /usr/sbin/vradmind fi if [ "$start_stats" -eq 1 ]; then # start stats /etc/vx/vras/templates/vvr_stats fi ;; 'stop') findproc vradmind; if [ "X$pid" != "X" ]; then /bin/kill -15 $pid fi findproc2 vvr_stats; if [ "X$pid" != "X" ]; then /bin/kill -9 $pid fi ;; *) export progname; ugettxt -n "VVR" -s "INFO" \ "Usage: $progname { start | stop }" vras.mesg:2408 exit 1 ;; esac exit 0