17836SJohn.Forte@Sun.COM#!/usr/bin/ksh 27836SJohn.Forte@Sun.COM# CDDL HEADER START 37836SJohn.Forte@Sun.COM# 47836SJohn.Forte@Sun.COM# The contents of this file are subject to the terms of the 57836SJohn.Forte@Sun.COM# Common Development and Distribution License (the "License"). 67836SJohn.Forte@Sun.COM# You may not use this file except in compliance with the License. 77836SJohn.Forte@Sun.COM# 87836SJohn.Forte@Sun.COM# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97836SJohn.Forte@Sun.COM# or http://www.opensolaris.org/os/licensing. 107836SJohn.Forte@Sun.COM# See the License for the specific language governing permissions 117836SJohn.Forte@Sun.COM# and limitations under the License. 127836SJohn.Forte@Sun.COM# 137836SJohn.Forte@Sun.COM# When distributing Covered Code, include this CDDL HEADER in each 147836SJohn.Forte@Sun.COM# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157836SJohn.Forte@Sun.COM# If applicable, add the following below this CDDL HEADER, with the 167836SJohn.Forte@Sun.COM# fields enclosed by brackets "[]" replaced with your own identifying 177836SJohn.Forte@Sun.COM# information: Portions Copyright [yyyy] [name of copyright owner] 187836SJohn.Forte@Sun.COM# 197836SJohn.Forte@Sun.COM# CDDL HEADER END 207836SJohn.Forte@Sun.COM# 217836SJohn.Forte@Sun.COM# 22*11996SThomas.Whitten@Sun.COM# Copyright 2010 Sun Microsystems, Inc. All rights reserved. 237836SJohn.Forte@Sun.COM# Use is subject to license terms. 247836SJohn.Forte@Sun.COM# 257836SJohn.Forte@Sun.COM 267836SJohn.Forte@Sun.COMtypeset -r PROG=$(basename $0) 277836SJohn.Forte@Sun.COMtypeset -r CTAG_NULL="-" 287836SJohn.Forte@Sun.COM 297836SJohn.Forte@Sun.COM# 307836SJohn.Forte@Sun.COM# help message 317836SJohn.Forte@Sun.COM# 327836SJohn.Forte@Sun.COMhelp() 337836SJohn.Forte@Sun.COM{ 347836SJohn.Forte@Sun.COM $xopt 357836SJohn.Forte@Sun.COM 367836SJohn.Forte@Sun.COM cluster_configured 377836SJohn.Forte@Sun.COM CLUSTER_CONFIGURED=$? 387836SJohn.Forte@Sun.COM 397836SJohn.Forte@Sun.COM echo "\ 407836SJohn.Forte@Sun.COMusage: 417836SJohn.Forte@Sun.COM $PROG 427836SJohn.Forte@Sun.COM $PROG -i 437836SJohn.Forte@Sun.COM $PROG -e [-r][-p] 447836SJohn.Forte@Sun.COM $PROG -d [-r]" >&2 457836SJohn.Forte@Sun.COM if [ $CLUSTER_CONFIGURED -eq 1 ]; then 467836SJohn.Forte@Sun.COM echo "\ 477836SJohn.Forte@Sun.COM $PROG -s" >&2 487836SJohn.Forte@Sun.COM fi 497836SJohn.Forte@Sun.COM 507836SJohn.Forte@Sun.COM echo "\ 517836SJohn.Forte@Sun.COM -i : display information on the Availability Suite services 527836SJohn.Forte@Sun.COM -e : enable Availability Suite services (all, by default) 537836SJohn.Forte@Sun.COM -d : disable Availability Suite services (all, by default) 547836SJohn.Forte@Sun.COM -r : enable/disable Remote Mirror 557836SJohn.Forte@Sun.COM -p : enable Point in Time Copy" >&2 567836SJohn.Forte@Sun.COM if [ $CLUSTER_CONFIGURED -eq 1 ]; then 577836SJohn.Forte@Sun.COM echo "\ 587836SJohn.Forte@Sun.COM -s : set the location of the cluster configuration database" >&2 597836SJohn.Forte@Sun.COM fi 607836SJohn.Forte@Sun.COM echo "\ 617836SJohn.Forte@Sun.COM -x : turn on script debugging (may be used with any valid option) 627836SJohn.Forte@Sun.COM 637836SJohn.Forte@Sun.COM When executed with no options or with nothing but -x, $PROG runs in 647836SJohn.Forte@Sun.COM interactive fashion, allowing the user to initialize the local (and 657836SJohn.Forte@Sun.COM if applicable, the cluster) configuration database, and to start the 667836SJohn.Forte@Sun.COM Availability Suite services." >&2 677836SJohn.Forte@Sun.COM 687836SJohn.Forte@Sun.COM exit 2 697836SJohn.Forte@Sun.COM} 707836SJohn.Forte@Sun.COM 717836SJohn.Forte@Sun.COM########################## SET GLOBAL VARIABLES ###################### 727836SJohn.Forte@Sun.COM 737836SJohn.Forte@Sun.COM# root directory 747836SJohn.Forte@Sun.COMPKG_INSTALL_ROOT="" 757836SJohn.Forte@Sun.COMexport PKG_INSTALL_ROOT 767836SJohn.Forte@Sun.COM 777836SJohn.Forte@Sun.COM# set lib path 787836SJohn.Forte@Sun.COMLD_LIBRARY_PATH=/usr/lib:/usr/lib 797836SJohn.Forte@Sun.COMexport LD_LIBRARY_PATH 807836SJohn.Forte@Sun.COM 817836SJohn.Forte@Sun.COM# set dscfg 827836SJohn.Forte@Sun.COMDSCFG="/usr/sbin/dscfg" 837836SJohn.Forte@Sun.COMexport DSCFG 847836SJohn.Forte@Sun.COM 857836SJohn.Forte@Sun.COM# set parser config location 867836SJohn.Forte@Sun.COMPCONFIG="/etc/dscfg_format" 877836SJohn.Forte@Sun.COMexport PCONFIG 887836SJohn.Forte@Sun.COM 897836SJohn.Forte@Sun.COM# set local dscfg location 907836SJohn.Forte@Sun.COMexport LOCAL_DSCFG="/etc/dscfg_local" 917836SJohn.Forte@Sun.COM 927836SJohn.Forte@Sun.COM# set cluster dscfg reference file 937836SJohn.Forte@Sun.COMexport CLUSTER_REF="/etc/dscfg_cluster" 947836SJohn.Forte@Sun.COM 957836SJohn.Forte@Sun.COM# a service that has a dependency on us 967836SJohn.Forte@Sun.COMFS_LOCAL_SVC="svc:/system/filesystem/local" 977836SJohn.Forte@Sun.COM 987836SJohn.Forte@Sun.COMNODELIST="/tmp/nodelist" 997836SJohn.Forte@Sun.COMDSCFGLOCKDCF="/etc/dscfg_lockdb" 1007836SJohn.Forte@Sun.COMDSCFG_DEPEND_NOCHK="/tmp/.dscfgadm_pid" 1017836SJohn.Forte@Sun.COM 1027836SJohn.Forte@Sun.COM# SMF defines 103*11996SThomas.Whitten@Sun.COMMANIFEST_PATH=/lib/svc/manifest/system 1047836SJohn.Forte@Sun.COM 1057836SJohn.Forte@Sun.COM# SMF services (enable and disable) 1067836SJohn.Forte@Sun.COMSMF_ENABLE="nws_scm nws_sv nws_ii nws_rdc nws_rdcsyncd" 1077836SJohn.Forte@Sun.COMSMF_DISABLE="nws_rdcsyncd nws_rdc nws_ii nws_sv nws_scm" 1087836SJohn.Forte@Sun.COM 1097836SJohn.Forte@Sun.COM# state of each service 1107836SJohn.Forte@Sun.COMnws_scm_enabled=0 1117836SJohn.Forte@Sun.COMnws_sv_enabled=0 1127836SJohn.Forte@Sun.COMnws_ii_enabled=0 1137836SJohn.Forte@Sun.COMnws_rdc_enabled=0 1147836SJohn.Forte@Sun.COMnws_rdcsyncd_enabled=0 1157836SJohn.Forte@Sun.COM 1167836SJohn.Forte@Sun.COM# set path 1177836SJohn.Forte@Sun.COMPATH=/usr/bin:/usr/sbin:/sbin/sh 1187836SJohn.Forte@Sun.COMexport PATH 1197836SJohn.Forte@Sun.COM 1207836SJohn.Forte@Sun.COM# set architecture 1217836SJohn.Forte@Sun.COMARCH=`uname -p` 1227836SJohn.Forte@Sun.COMexport ARCH 1237836SJohn.Forte@Sun.COMOS_MINOR=`uname -r | cut -d '.' -f2` 1247836SJohn.Forte@Sun.COM 1257836SJohn.Forte@Sun.COM# number of sectors required for database 1267836SJohn.Forte@Sun.COM# 1024*1024*5.5/512 1277836SJohn.Forte@Sun.COMREQUIRED=11264 1287836SJohn.Forte@Sun.COM 1297836SJohn.Forte@Sun.COM# must set here, else seen as null in MAIN 1307836SJohn.Forte@Sun.COMVALID_DB_ENTERED=0 1317836SJohn.Forte@Sun.COM 1327836SJohn.Forte@Sun.COMNO_ARGS=0 1337836SJohn.Forte@Sun.COM 1347836SJohn.Forte@Sun.COM# for debugging 1357836SJohn.Forte@Sun.COMxopt= 1367836SJohn.Forte@Sun.COM 1377836SJohn.Forte@Sun.COM# set lengthy message here 1387836SJohn.Forte@Sun.COMCLUST_LOC_MESS="The current location is invalid for a Sun StorageTek \ 1397836SJohn.Forte@Sun.COMData Services configuration database. Once a valid location is \ 1407836SJohn.Forte@Sun.COMentered (raw slice on \"did\" device), you may upgrade the existing \ 1417836SJohn.Forte@Sun.COMdatabase to this new location - following the procedure outlined \ 1427836SJohn.Forte@Sun.COMin the Installation and Configuration Guide." 1437836SJohn.Forte@Sun.COM 1447836SJohn.Forte@Sun.COM########################## SET GLOBAL VARIABLES ###################### 1457836SJohn.Forte@Sun.COM 1467836SJohn.Forte@Sun.COM 1477836SJohn.Forte@Sun.COM########################## ERROR #################################### 1487836SJohn.Forte@Sun.COM 1497836SJohn.Forte@Sun.COM# called with optional error msg $1 1507836SJohn.Forte@Sun.COM# prints basic guidelines for configuration of the database location 1517836SJohn.Forte@Sun.COMerror() 1527836SJohn.Forte@Sun.COM{ 1537836SJohn.Forte@Sun.COM $xopt 1547836SJohn.Forte@Sun.COM 1557836SJohn.Forte@Sun.COM echo >&2 1567836SJohn.Forte@Sun.COM echo "INSTALLATION ERROR" >&2 1577836SJohn.Forte@Sun.COM echo "Error: $1" >&2 1587836SJohn.Forte@Sun.COM echo >&2 1597836SJohn.Forte@Sun.COM in_cluster 1607836SJohn.Forte@Sun.COM 1617836SJohn.Forte@Sun.COM if [ $? -eq 1 ]; then 1627836SJohn.Forte@Sun.COM echo "GENERAL INSTALLATION RULES:" >&2 1637836SJohn.Forte@Sun.COM echo "\tBecause you are installing on a cluster," >&2 1647836SJohn.Forte@Sun.COM echo "\tthe database must be located on a raw slice of a did device.">&2 1657836SJohn.Forte@Sun.COM echo "\t e.g. /dev/did/rdsk/d17s1" >&2 1667836SJohn.Forte@Sun.COM fi 1677836SJohn.Forte@Sun.COM # let? 1687836SJohn.Forte@Sun.COM MB=`expr $REQUIRED / 2 / 1024` 1697836SJohn.Forte@Sun.COM echo "\t$REQUIRED sectors ($MB MBs) are required for the database." >&2 1707836SJohn.Forte@Sun.COM} 1717836SJohn.Forte@Sun.COM 1727836SJohn.Forte@Sun.COM########################## ERROR #################################### 1737836SJohn.Forte@Sun.COM 1747836SJohn.Forte@Sun.COM########################## ALL LOCATION TESTS ######################## 1757836SJohn.Forte@Sun.COM 1767836SJohn.Forte@Sun.COM# sets numerous environment variables describing the state of the system 1777836SJohn.Forte@Sun.COMget_system_state() 1787836SJohn.Forte@Sun.COM{ 1797836SJohn.Forte@Sun.COM $xopt 1807836SJohn.Forte@Sun.COM 1817836SJohn.Forte@Sun.COM valid_local_dscfg_exists 1827836SJohn.Forte@Sun.COM VALID_LOCAL_DB=$? 1837836SJohn.Forte@Sun.COM OLD_VALID_LOCAL_DB=$VALID_LOCAL_DB 1847836SJohn.Forte@Sun.COM 1857836SJohn.Forte@Sun.COM in_cluster 1867836SJohn.Forte@Sun.COM IN_CLUSTER=$? 1877836SJohn.Forte@Sun.COM 1887836SJohn.Forte@Sun.COM cluster_configured 1897836SJohn.Forte@Sun.COM CLUSTER_CONFIGURED=$? 1907836SJohn.Forte@Sun.COM 1917836SJohn.Forte@Sun.COM if [ $IN_CLUSTER = 1 ]; then 1927836SJohn.Forte@Sun.COM valid_cluster_dscfg_exists 1937836SJohn.Forte@Sun.COM VALID_CLUSTER_DB=$? 1947836SJohn.Forte@Sun.COM OLD_VALID_CLUSTER_DB=$VALID_CLUSTER_DB 1957836SJohn.Forte@Sun.COM else 1967836SJohn.Forte@Sun.COM VALID_CLUSTER_DB=0 1977836SJohn.Forte@Sun.COM fi 1987836SJohn.Forte@Sun.COM} 1997836SJohn.Forte@Sun.COM 2007836SJohn.Forte@Sun.COM# Checks if in cluster 2017836SJohn.Forte@Sun.COM# returns 1 if in cluster, else 0 2027836SJohn.Forte@Sun.COM# 2037836SJohn.Forte@Sun.COMin_cluster() 2047836SJohn.Forte@Sun.COM{ 2057836SJohn.Forte@Sun.COM $xopt 2067836SJohn.Forte@Sun.COM 2077836SJohn.Forte@Sun.COM if [ -x /usr/sbin/clinfo ]; then 2087836SJohn.Forte@Sun.COM clinfo 2097836SJohn.Forte@Sun.COM if [ $? -eq 0 ]; then 2107836SJohn.Forte@Sun.COM return 1 2117836SJohn.Forte@Sun.COM else 2127836SJohn.Forte@Sun.COM return 0 2137836SJohn.Forte@Sun.COM fi 2147836SJohn.Forte@Sun.COM else 2157836SJohn.Forte@Sun.COM return 0 2167836SJohn.Forte@Sun.COM fi 2177836SJohn.Forte@Sun.COM} 2187836SJohn.Forte@Sun.COM 2197836SJohn.Forte@Sun.COM# checks if a system is configured as a cluster 2207836SJohn.Forte@Sun.COM# returns 1 if configured as a cluster, 0 if not 2217836SJohn.Forte@Sun.COM# 2227836SJohn.Forte@Sun.COMcluster_configured() 2237836SJohn.Forte@Sun.COM{ 2247836SJohn.Forte@Sun.COM $xopt 2257836SJohn.Forte@Sun.COM 2267836SJohn.Forte@Sun.COM if [ -f /etc/cluster/nodeid ]; then 2277836SJohn.Forte@Sun.COM return 1 2287836SJohn.Forte@Sun.COM else 2297836SJohn.Forte@Sun.COM return 0 2307836SJohn.Forte@Sun.COM fi 2317836SJohn.Forte@Sun.COM} 2327836SJohn.Forte@Sun.COM 2337836SJohn.Forte@Sun.COM# Check the list of Sun Cluster device groups known in the dscfg, determing 2347836SJohn.Forte@Sun.COM# if they are currently enabled on this Sun Cluster node. If so, fail allowing 2357836SJohn.Forte@Sun.COM# the system administator to scswitch them elsewhere. 2367836SJohn.Forte@Sun.COM# 2377836SJohn.Forte@Sun.COMcheck_device_groups() 2387836SJohn.Forte@Sun.COM{ 2397836SJohn.Forte@Sun.COM $xopt 2407836SJohn.Forte@Sun.COM 2417836SJohn.Forte@Sun.COM if [ $VALID_CLUSTER_DB == 1 ]; then 2427836SJohn.Forte@Sun.COM DEVICE_GROUPS=`$DSCFG -s $FILE_LOC -l 2>/dev/null | \ 2437836SJohn.Forte@Sun.COM grep "^dsvol:" | cut -d' ' -f3 | sort | uniq | xargs` 2447836SJohn.Forte@Sun.COM for x in $DEVICE_GROUPS 2457836SJohn.Forte@Sun.COM do 2467836SJohn.Forte@Sun.COM $DSCFG -D $x 2>/dev/null 2477836SJohn.Forte@Sun.COM if [ $? -eq 1 ] 2487836SJohn.Forte@Sun.COM then 2497836SJohn.Forte@Sun.COM IN_USE="$IN_USE $x" 2507836SJohn.Forte@Sun.COM fi 2517836SJohn.Forte@Sun.COM done 2527836SJohn.Forte@Sun.COM 2537836SJohn.Forte@Sun.COM if [ -n "$IN_USE" ] 2547836SJohn.Forte@Sun.COM then 2557836SJohn.Forte@Sun.COM print "The following Sun Cluster device groups are in use " 2567836SJohn.Forte@Sun.COM print "by Availability Suite on this node." 2577836SJohn.Forte@Sun.COM print "" 2587836SJohn.Forte@Sun.COM print "$IN_USE" 2597836SJohn.Forte@Sun.COM print "" 2607836SJohn.Forte@Sun.COM print "'scswitch' them to another Sun Cluster node before " 2617836SJohn.Forte@Sun.COM print "attempting to disable any data services." 2627836SJohn.Forte@Sun.COM return 1 2637836SJohn.Forte@Sun.COM else 2647836SJohn.Forte@Sun.COM return 0 2657836SJohn.Forte@Sun.COM fi 2667836SJohn.Forte@Sun.COM fi 2677836SJohn.Forte@Sun.COM 2687836SJohn.Forte@Sun.COM return 0 2697836SJohn.Forte@Sun.COM} 2707836SJohn.Forte@Sun.COM 2717836SJohn.Forte@Sun.COM# checks to see if this is a char device in the 2727836SJohn.Forte@Sun.COM# /dev/did/rdsk directory returns 1 if so. 2737836SJohn.Forte@Sun.COM# 2747836SJohn.Forte@Sun.COMis_did_device() 2757836SJohn.Forte@Sun.COM{ 2767836SJohn.Forte@Sun.COM $xopt 2777836SJohn.Forte@Sun.COM 2787836SJohn.Forte@Sun.COM DID=`echo $1 | awk -F/ '{print $3}'` 2797836SJohn.Forte@Sun.COM RDSK=`echo $1 | awk -F/ '{print $4}'` 2807836SJohn.Forte@Sun.COM 2817836SJohn.Forte@Sun.COM if [ "did" = $DID -a "rdsk" = $RDSK -a -c $1 ]; then 2827836SJohn.Forte@Sun.COM return 1 2837836SJohn.Forte@Sun.COM else 2847836SJohn.Forte@Sun.COM return 0 2857836SJohn.Forte@Sun.COM fi 2867836SJohn.Forte@Sun.COM} 2877836SJohn.Forte@Sun.COM 2887836SJohn.Forte@Sun.COM# 2897836SJohn.Forte@Sun.COM# checks size of area for db location 2907836SJohn.Forte@Sun.COM# 2917836SJohn.Forte@Sun.COMcheck_size() 2927836SJohn.Forte@Sun.COM{ 2937836SJohn.Forte@Sun.COM $xopt 2947836SJohn.Forte@Sun.COM 2957836SJohn.Forte@Sun.COM # if in cluster look for d*s* 2967836SJohn.Forte@Sun.COM SLICE=`echo $1 | sed -n 's/.*d.*s\(.*\)/\1/p'` 2977836SJohn.Forte@Sun.COM 2987836SJohn.Forte@Sun.COM SECTORS=`prtvtoc $1 | tr -s ' '| grep "^ $SLICE " | awk '{print $5}'` 2997836SJohn.Forte@Sun.COM 3007836SJohn.Forte@Sun.COM if [ -z "$SECTORS" ]; then 3017836SJohn.Forte@Sun.COM echo "SLICE at $1 not found on this device" 3027836SJohn.Forte@Sun.COM return 0 3037836SJohn.Forte@Sun.COM fi 3047836SJohn.Forte@Sun.COM 3057836SJohn.Forte@Sun.COM # if required size is greater than space available, then fail 3067836SJohn.Forte@Sun.COM if [ $REQUIRED -gt $SECTORS ]; then 3077836SJohn.Forte@Sun.COM return 0 3087836SJohn.Forte@Sun.COM else 3097836SJohn.Forte@Sun.COM return 1 3107836SJohn.Forte@Sun.COM fi 3117836SJohn.Forte@Sun.COM} 3127836SJohn.Forte@Sun.COM 3137836SJohn.Forte@Sun.COM# looks in dscfg_cluster reference file. if a location is configured, 3147836SJohn.Forte@Sun.COM# tests to see if it is a valid database. if so, returns 1 3157836SJohn.Forte@Sun.COM# 3167836SJohn.Forte@Sun.COMvalid_cluster_dscfg_exists() 3177836SJohn.Forte@Sun.COM{ 3187836SJohn.Forte@Sun.COM $xopt 3197836SJohn.Forte@Sun.COM 3207836SJohn.Forte@Sun.COM if [ -s $CLUSTER_REF ]; then 3217836SJohn.Forte@Sun.COM FILE_LOC=`head -1 $CLUSTER_REF` 3227836SJohn.Forte@Sun.COM contains_data $FILE_LOC 3237836SJohn.Forte@Sun.COM return $? 3247836SJohn.Forte@Sun.COM else 3257836SJohn.Forte@Sun.COM return 0 3267836SJohn.Forte@Sun.COM fi 3277836SJohn.Forte@Sun.COM} 3287836SJohn.Forte@Sun.COM 3297836SJohn.Forte@Sun.COM 3307836SJohn.Forte@Sun.COM# checks for the existence of dscfg_local database, and if it exists, 3317836SJohn.Forte@Sun.COM# tests to see if it is a valid database. if so, returns 1 3327836SJohn.Forte@Sun.COM# 3337836SJohn.Forte@Sun.COMvalid_local_dscfg_exists() 3347836SJohn.Forte@Sun.COM{ 3357836SJohn.Forte@Sun.COM $xopt 3367836SJohn.Forte@Sun.COM 3377836SJohn.Forte@Sun.COM if [ -s $LOCAL_DSCFG ]; then 3387836SJohn.Forte@Sun.COM contains_data $LOCAL_DSCFG 3397836SJohn.Forte@Sun.COM return $? 3407836SJohn.Forte@Sun.COM else 3417836SJohn.Forte@Sun.COM return 0 3427836SJohn.Forte@Sun.COM fi 3437836SJohn.Forte@Sun.COM} 3447836SJohn.Forte@Sun.COM 3457836SJohn.Forte@Sun.COM# used to test if a valid DS config database exists on machine already 3467836SJohn.Forte@Sun.COM# MAGIC_STRING is the top line in the config used in v3.1 & v3.2 3477836SJohn.Forte@Sun.COM# 3487836SJohn.Forte@Sun.COMcontains_data() 3497836SJohn.Forte@Sun.COM{ 3507836SJohn.Forte@Sun.COM $xopt 3517836SJohn.Forte@Sun.COM 3527836SJohn.Forte@Sun.COM # dscfg distinct strings, varies on the architecture 3537836SJohn.Forte@Sun.COM if [ $ARCH = "sparc" ] 3547836SJohn.Forte@Sun.COM then 3557836SJohn.Forte@Sun.COM MAGIC_STRING="MAGI" 3567836SJohn.Forte@Sun.COM elif [ $ARCH = "i386" ] 3577836SJohn.Forte@Sun.COM then 3587836SJohn.Forte@Sun.COM MAGIC_STRING="IGAM" 3597836SJohn.Forte@Sun.COM fi 3607836SJohn.Forte@Sun.COM 3617836SJohn.Forte@Sun.COM # Create a PID unique temporary file 3627836SJohn.Forte@Sun.COM TMP_FILE=/tmp/$$ 3637836SJohn.Forte@Sun.COM 3647836SJohn.Forte@Sun.COM # Write the first or 16th block (skipping over VTOC) to 3657836SJohn.Forte@Sun.COM # the TMP_FILE, then scan for the presence of the "MAGI" 3667836SJohn.Forte@Sun.COM # 3677836SJohn.Forte@Sun.COM for offset in 0 16 3687836SJohn.Forte@Sun.COM do 3697836SJohn.Forte@Sun.COM if [ ! -z "$1" ]; then 3707836SJohn.Forte@Sun.COM dd if=$1 of=$TMP_FILE count=1 iseek=$offset 2>/dev/null 3717836SJohn.Forte@Sun.COM FILECONTENTS=`strings $TMP_FILE | head -1 2>/dev/null` 3727836SJohn.Forte@Sun.COM if [ `echo $FILECONTENTS | grep -c "$MAGIC_STRING"` -gt 0 ]; then 3737836SJohn.Forte@Sun.COM rm $TMP_FILE 3747836SJohn.Forte@Sun.COM return 1 3757836SJohn.Forte@Sun.COM fi 3767836SJohn.Forte@Sun.COM fi 3777836SJohn.Forte@Sun.COM done 3787836SJohn.Forte@Sun.COM 3797836SJohn.Forte@Sun.COM rm $TMP_FILE 3807836SJohn.Forte@Sun.COM return 0 3817836SJohn.Forte@Sun.COM} 3827836SJohn.Forte@Sun.COM 3837836SJohn.Forte@Sun.COM########################## ALL LOCATION TESTS ######################## 3847836SJohn.Forte@Sun.COM 3857836SJohn.Forte@Sun.COM 3867836SJohn.Forte@Sun.COM########################## MAIN FUNCTIONS ############################ 3877836SJohn.Forte@Sun.COM 3887836SJohn.Forte@Sun.COM# since location already has been set, asks what to do now? keeping 3897836SJohn.Forte@Sun.COM# it still checks the size (since an upgrade from 3.0 may still be 3907836SJohn.Forte@Sun.COM# occuring) and also checks if was an old cluster config on disallowed 3917836SJohn.Forte@Sun.COM# /dev/did/dsk directory 3927836SJohn.Forte@Sun.COM# 3937836SJohn.Forte@Sun.COM# returns: 3947836SJohn.Forte@Sun.COM# 0 if cluster location is invalid or the user does not want to keep it 3957836SJohn.Forte@Sun.COM# 1 if the location is valid and the user wants to keep it. 3967836SJohn.Forte@Sun.COM# 3977836SJohn.Forte@Sun.COMkeep_it() 3987836SJohn.Forte@Sun.COM{ 3997836SJohn.Forte@Sun.COM $xopt 4007836SJohn.Forte@Sun.COM 4017836SJohn.Forte@Sun.COM NOTE="\nThe Sun StorageTek Data Services database configuration" 4027836SJohn.Forte@Sun.COM NOTE="$NOTE location has already been set." 4037836SJohn.Forte@Sun.COM echo $NOTE 4047836SJohn.Forte@Sun.COM 4057836SJohn.Forte@Sun.COM echo "\nCurrent location: $PKG_INSTALL_ROOT$FILE_LOC" 4067836SJohn.Forte@Sun.COM 4077836SJohn.Forte@Sun.COM QUEST="Would you like to preserve the existing configuration" 4087836SJohn.Forte@Sun.COM QUEST="$QUEST information at its current location? " 4097836SJohn.Forte@Sun.COM 4107836SJohn.Forte@Sun.COM ANS=`ckyorn -Qd n -p "$QUEST"` 4117836SJohn.Forte@Sun.COM 4127836SJohn.Forte@Sun.COM case $ANS in 4137836SJohn.Forte@Sun.COM y|Y|yes|YES|Yes) 4147836SJohn.Forte@Sun.COM #Since the user has said "yes I want to keep this current one" 4157836SJohn.Forte@Sun.COM #it may actually be a 3.x database, which only required 4.5mb 4167836SJohn.Forte@Sun.COM #space, so now will check that there is room to grow another 1mb" 4177836SJohn.Forte@Sun.COM check_location $FILE_LOC 4187836SJohn.Forte@Sun.COM if [ $? = 0 ]; then 4197836SJohn.Forte@Sun.COM error "$CLUST_LOC_MESS" 4207836SJohn.Forte@Sun.COM return 0 4217836SJohn.Forte@Sun.COM else 4227836SJohn.Forte@Sun.COM OLD_FILE_LOC=$FILE_LOC 4237836SJohn.Forte@Sun.COM FILE_LOC=$NULL 4247836SJohn.Forte@Sun.COM return 1 4257836SJohn.Forte@Sun.COM fi 4267836SJohn.Forte@Sun.COM ;; 4277836SJohn.Forte@Sun.COM *) 4287836SJohn.Forte@Sun.COM return 0 4297836SJohn.Forte@Sun.COM ;; 4307836SJohn.Forte@Sun.COM esac 4317836SJohn.Forte@Sun.COM} 4327836SJohn.Forte@Sun.COM 4337836SJohn.Forte@Sun.COM# 4347836SJohn.Forte@Sun.COM# asks if user wants to keep existing db information, overwrite with 4357836SJohn.Forte@Sun.COM# a new db, or view the contents, and be asked again... 4367836SJohn.Forte@Sun.COM# returns: 4377836SJohn.Forte@Sun.COM# 0 if old location is bad 4387836SJohn.Forte@Sun.COM# 1 if old location is good 4397836SJohn.Forte@Sun.COM# 4407836SJohn.Forte@Sun.COMpreserve_overwrite_maybe() 4417836SJohn.Forte@Sun.COM{ 4427836SJohn.Forte@Sun.COM $xopt 4437836SJohn.Forte@Sun.COM 4447836SJohn.Forte@Sun.COM echo "\nIt appears a valid database configuration exists here already." 4457836SJohn.Forte@Sun.COM 4467836SJohn.Forte@Sun.COM while true 4477836SJohn.Forte@Sun.COM do 4487836SJohn.Forte@Sun.COM SAFE_LOC=$FILE_LOC 4497836SJohn.Forte@Sun.COM 4507836SJohn.Forte@Sun.COM echo "\nWould you like to preserve this information and continue?" 4517836SJohn.Forte@Sun.COM echo "\ty - preserve current configuration" 4527836SJohn.Forte@Sun.COM echo "\tn - overwrite with new configuration" 4537836SJohn.Forte@Sun.COM echo "\tmaybe - view contents of current configuration" 4547836SJohn.Forte@Sun.COM 4557836SJohn.Forte@Sun.COM ANS=`ckkeywd -Q y n maybe` 4567836SJohn.Forte@Sun.COM case $ANS in 4577836SJohn.Forte@Sun.COM y) 4587836SJohn.Forte@Sun.COM check_location $FILE_LOC 4597836SJohn.Forte@Sun.COM if [ $? = 0 ]; then 4607836SJohn.Forte@Sun.COM error "$CLUST_LOC_MESS" 4617836SJohn.Forte@Sun.COM return 0 4627836SJohn.Forte@Sun.COM else 4637836SJohn.Forte@Sun.COM $DSCFG -s "$FILE_LOC" -C $CTAG_NULL >/dev/null 2>&1 4647836SJohn.Forte@Sun.COM OLD_FILE_LOC=$FILE_LOC 4657836SJohn.Forte@Sun.COM FILE_LOC=$NULL 4667836SJohn.Forte@Sun.COM return 1 4677836SJohn.Forte@Sun.COM fi 4687836SJohn.Forte@Sun.COM ;; 4697836SJohn.Forte@Sun.COM n) 4707836SJohn.Forte@Sun.COM check_location $FILE_LOC 4717836SJohn.Forte@Sun.COM if [ $? = 0 ]; then 4727836SJohn.Forte@Sun.COM error "$CLUST_LOC_MESS" 4737836SJohn.Forte@Sun.COM return 0 4747836SJohn.Forte@Sun.COM else 4757836SJohn.Forte@Sun.COM return 1 4767836SJohn.Forte@Sun.COM fi 4777836SJohn.Forte@Sun.COM ;; 4787836SJohn.Forte@Sun.COM 4797836SJohn.Forte@Sun.COM maybe) 4807836SJohn.Forte@Sun.COM # print contents of this db config. 4817836SJohn.Forte@Sun.COM echo "\nContents of database configuration found at $SAFE_LOC are:" 4827836SJohn.Forte@Sun.COM $DSCFG -l -s "$FILE_LOC" | more 4837836SJohn.Forte@Sun.COM FILE_LOC=$SAFE_LOC 4847836SJohn.Forte@Sun.COM continue 4857836SJohn.Forte@Sun.COM ;; 4867836SJohn.Forte@Sun.COM esac 4877836SJohn.Forte@Sun.COM done 4887836SJohn.Forte@Sun.COM} 4897836SJohn.Forte@Sun.COM 4907836SJohn.Forte@Sun.COM# gets location from user 4917836SJohn.Forte@Sun.COM# 4927836SJohn.Forte@Sun.COMget_location() 4937836SJohn.Forte@Sun.COM{ 4947836SJohn.Forte@Sun.COM $xopt 4957836SJohn.Forte@Sun.COM 4967836SJohn.Forte@Sun.COM #Checks for absolute path name, and if file name and file doesn't 4977836SJohn.Forte@Sun.COM #exist, creates it. 4987836SJohn.Forte@Sun.COM echo "\n\n----------ENTER DATABASE CONFIGURATION LOCATION-----------------" 4997836SJohn.Forte@Sun.COM echo "Note: Please ensure this location meets all requirements specified" 5007836SJohn.Forte@Sun.COM echo "in the Availability Suite Installation Guide." 5017836SJohn.Forte@Sun.COM 5027836SJohn.Forte@Sun.COM FILE_LOC=`ckpath -artwQ -p "Enter location:"` 5037836SJohn.Forte@Sun.COM if [ $? = 1 ] 5047836SJohn.Forte@Sun.COM then 5057836SJohn.Forte@Sun.COM exit 1 5067836SJohn.Forte@Sun.COM fi 5077836SJohn.Forte@Sun.COM 5087836SJohn.Forte@Sun.COM # allow non-root user to access for least privileges 5097836SJohn.Forte@Sun.COM chmod 666 $FILE_LOC 5107836SJohn.Forte@Sun.COM} 5117836SJohn.Forte@Sun.COM 5127836SJohn.Forte@Sun.COM 5137836SJohn.Forte@Sun.COM# 5147836SJohn.Forte@Sun.COM# tests for proper config 5157836SJohn.Forte@Sun.COM# 5167836SJohn.Forte@Sun.COM# returns: 5177836SJohn.Forte@Sun.COM# 0 if bad location 5187836SJohn.Forte@Sun.COM# 1 if good location 5197836SJohn.Forte@Sun.COM# 5207836SJohn.Forte@Sun.COMcheck_location() 5217836SJohn.Forte@Sun.COM{ 5227836SJohn.Forte@Sun.COM $xopt 5237836SJohn.Forte@Sun.COM 5247836SJohn.Forte@Sun.COM # set to FILE_LOC 5257836SJohn.Forte@Sun.COM LOCATION=$1 5267836SJohn.Forte@Sun.COM 5277836SJohn.Forte@Sun.COM did_clust_msg="You are in cluster and $LOCATION is not valid DID device" 5287836SJohn.Forte@Sun.COM 5297836SJohn.Forte@Sun.COM # Set "actual file location" variable here to equal file location 5307836SJohn.Forte@Sun.COM # entered by user because getting here means contains_data was already 5317836SJohn.Forte@Sun.COM # successfully called before and now the two can equal each other for 5327836SJohn.Forte@Sun.COM # future testing. 5337836SJohn.Forte@Sun.COM 5347836SJohn.Forte@Sun.COM SAFE_LOC=$FILE_LOC 5357836SJohn.Forte@Sun.COM 5367836SJohn.Forte@Sun.COM if [ $IN_CLUSTER = 1 -o $CLUSTER_CONFIGURED = 1 ]; then 5377836SJohn.Forte@Sun.COM if [ -b "$LOCATION" ] || [ -c "$LOCATION" ]; then 5387836SJohn.Forte@Sun.COM is_did_device $LOCATION 5397836SJohn.Forte@Sun.COM if [ $? = 0 ]; then 5407836SJohn.Forte@Sun.COM error "$did_clust_msg" 5417836SJohn.Forte@Sun.COM return 0 5427836SJohn.Forte@Sun.COM fi 5437836SJohn.Forte@Sun.COM else 5447836SJohn.Forte@Sun.COM error "$did_clust_msg" 5457836SJohn.Forte@Sun.COM return 0 5467836SJohn.Forte@Sun.COM fi 5477836SJohn.Forte@Sun.COM else 5487836SJohn.Forte@Sun.COM echo "Location may not be changed in a non Sun Cluster OE." 2>&1 5497836SJohn.Forte@Sun.COM return 0 5507836SJohn.Forte@Sun.COM fi 5517836SJohn.Forte@Sun.COM 5527836SJohn.Forte@Sun.COM check_size $LOCATION 5537836SJohn.Forte@Sun.COM 5547836SJohn.Forte@Sun.COM if [ $? != 1 ]; then 5557836SJohn.Forte@Sun.COM error "$LOCATION does not meet minimum space requirement." 5567836SJohn.Forte@Sun.COM return 0 5577836SJohn.Forte@Sun.COM else 5587836SJohn.Forte@Sun.COM return 1 5597836SJohn.Forte@Sun.COM fi 5607836SJohn.Forte@Sun.COM} 5617836SJohn.Forte@Sun.COM 5627836SJohn.Forte@Sun.COM# 5637836SJohn.Forte@Sun.COM# Notifies the user that the SMF services are online, 5647836SJohn.Forte@Sun.COM# and gives him the option to disable the services before proceeding. If 5657836SJohn.Forte@Sun.COM# the services are not disabled, the program cannot proceed with setting 5667836SJohn.Forte@Sun.COM# a new dscfg location. 5677836SJohn.Forte@Sun.COM# 5687836SJohn.Forte@Sun.COMask_to_disable() 5697836SJohn.Forte@Sun.COM{ 5707836SJohn.Forte@Sun.COM $xopt 5717836SJohn.Forte@Sun.COM 5727836SJohn.Forte@Sun.COM echo "\ 5737836SJohn.Forte@Sun.COM\nYour services must be disabled before a new configuration location is set.\n" 5747836SJohn.Forte@Sun.COM 5757836SJohn.Forte@Sun.COM QUEST="Would you like to disable the services now and continue with the" 5767836SJohn.Forte@Sun.COM QUEST="$QUEST Availability Suite setup? " 5777836SJohn.Forte@Sun.COM 5787836SJohn.Forte@Sun.COM ANS=`ckyorn -Qd n -p "$QUEST"` 5797836SJohn.Forte@Sun.COM 5807836SJohn.Forte@Sun.COM case $ANS 5817836SJohn.Forte@Sun.COM in y|Y|yes|YES|Yes) 5827836SJohn.Forte@Sun.COM return 1 5837836SJohn.Forte@Sun.COM ;; 5847836SJohn.Forte@Sun.COM *) 5857836SJohn.Forte@Sun.COM return 0 5867836SJohn.Forte@Sun.COM ;; 5877836SJohn.Forte@Sun.COM esac 5887836SJohn.Forte@Sun.COM} 5897836SJohn.Forte@Sun.COM 5907836SJohn.Forte@Sun.COM# 5917836SJohn.Forte@Sun.COM# Asks the user if he would like to enable the services now. If so, 5927836SJohn.Forte@Sun.COM# import them (if necessary) and enable them. 5937836SJohn.Forte@Sun.COM# 5947836SJohn.Forte@Sun.COMask_to_enable() 5957836SJohn.Forte@Sun.COM{ 5967836SJohn.Forte@Sun.COM $xopt 5977836SJohn.Forte@Sun.COM 5987836SJohn.Forte@Sun.COM echo "\ 5997836SJohn.Forte@Sun.COM\nIf you would like to start using the Availability Suite immediately, you may 6007836SJohn.Forte@Sun.COMstart the SMF services now. You may also choose to start the services later 6017836SJohn.Forte@Sun.COMusing the $PROG -e command." 6027836SJohn.Forte@Sun.COM 6037836SJohn.Forte@Sun.COM QUEST="Would you like to start the services now? " 6047836SJohn.Forte@Sun.COM 6057836SJohn.Forte@Sun.COM ANS=`ckyorn -Qd n -p "$QUEST"` 6067836SJohn.Forte@Sun.COM 6077836SJohn.Forte@Sun.COM case $ANS 6087836SJohn.Forte@Sun.COM in y|Y|yes|YES|Yes) 6097836SJohn.Forte@Sun.COM return 1 6107836SJohn.Forte@Sun.COM ;; 6117836SJohn.Forte@Sun.COM *) 6127836SJohn.Forte@Sun.COM return 0 6137836SJohn.Forte@Sun.COM ;; 6147836SJohn.Forte@Sun.COM esac 6157836SJohn.Forte@Sun.COM} 6167836SJohn.Forte@Sun.COM 6177836SJohn.Forte@Sun.COM# 6187836SJohn.Forte@Sun.COM# display information about the system 6197836SJohn.Forte@Sun.COM# 6207836SJohn.Forte@Sun.COMdisplay_info() 6217836SJohn.Forte@Sun.COM{ 6227836SJohn.Forte@Sun.COM $xopt 6237836SJohn.Forte@Sun.COM 6247836SJohn.Forte@Sun.COM typeset grp_error_flg=0 6257836SJohn.Forte@Sun.COM typeset -L15 svc state en SVC="SERVICE" STATE="STATE" EN="ENABLED" 6267836SJohn.Forte@Sun.COM echo "$SVC\t$STATE\t$EN" 6277836SJohn.Forte@Sun.COM 6287836SJohn.Forte@Sun.COM for i in $SMF_ENABLE 6297836SJohn.Forte@Sun.COM do 6307836SJohn.Forte@Sun.COM is_imported $i 6317836SJohn.Forte@Sun.COM if [ $? = 1 ] 6327836SJohn.Forte@Sun.COM then 6337836SJohn.Forte@Sun.COM state=`svcprop -c -p restarter/state \ 6347836SJohn.Forte@Sun.COM svc:/system/${i}:default` 6357836SJohn.Forte@Sun.COM en=`svcprop -c -p general/enabled \ 6367836SJohn.Forte@Sun.COM svc:/system/${i}:default` 6377836SJohn.Forte@Sun.COM check_fs_local_grouping $i 6387836SJohn.Forte@Sun.COM if [ $? -ne 0 ] 6397836SJohn.Forte@Sun.COM then 6407836SJohn.Forte@Sun.COM svc="${i}***" 6417836SJohn.Forte@Sun.COM grp_error_flg=$((grp_error_flg + 1)) 6427836SJohn.Forte@Sun.COM else 6437836SJohn.Forte@Sun.COM svc=$i 6447836SJohn.Forte@Sun.COM fi 6457836SJohn.Forte@Sun.COM 6467836SJohn.Forte@Sun.COM echo "$svc\t$state\t$en" 6477836SJohn.Forte@Sun.COM fi 6487836SJohn.Forte@Sun.COM done 6497836SJohn.Forte@Sun.COM 6507836SJohn.Forte@Sun.COM print "\nAvailability Suite Configuration:" 6517836SJohn.Forte@Sun.COM printf "Local configuration database: " 6527836SJohn.Forte@Sun.COM if [ $VALID_LOCAL_DB = 1 ] 6537836SJohn.Forte@Sun.COM then 6547836SJohn.Forte@Sun.COM print "valid" 6557836SJohn.Forte@Sun.COM else 6567836SJohn.Forte@Sun.COM print "invalid" 6577836SJohn.Forte@Sun.COM fi 6587836SJohn.Forte@Sun.COM 6597836SJohn.Forte@Sun.COM if [ $CLUSTER_CONFIGURED = 1 ] 6607836SJohn.Forte@Sun.COM then 6617836SJohn.Forte@Sun.COM printf "cluster configuration database: " 6627836SJohn.Forte@Sun.COM if [ $VALID_CLUSTER_DB = 1 ] 6637836SJohn.Forte@Sun.COM then 6647836SJohn.Forte@Sun.COM print "valid" 6657836SJohn.Forte@Sun.COM print "cluster configuration location: ${FILE_LOC}" 6667836SJohn.Forte@Sun.COM else 6677836SJohn.Forte@Sun.COM print "invalid" 6687836SJohn.Forte@Sun.COM fi 6697836SJohn.Forte@Sun.COM fi 6707836SJohn.Forte@Sun.COM 6717836SJohn.Forte@Sun.COM if [ $grp_error_flg -gt 0 ] 6727836SJohn.Forte@Sun.COM then 6737836SJohn.Forte@Sun.COM typeset p 6747836SJohn.Forte@Sun.COM typeset p_has 6757836SJohn.Forte@Sun.COM if [ $grp_error_flg -gt 1 ] 6767836SJohn.Forte@Sun.COM then 6777836SJohn.Forte@Sun.COM p="s" 6787836SJohn.Forte@Sun.COM p_has="have" 6797836SJohn.Forte@Sun.COM else 6807836SJohn.Forte@Sun.COM p="" 6817836SJohn.Forte@Sun.COM p_has="has" 6827836SJohn.Forte@Sun.COM fi 6837836SJohn.Forte@Sun.COM 6847836SJohn.Forte@Sun.COM printf "\n*** Warning: The service$p above $p_has an incorrect " 6857836SJohn.Forte@Sun.COM printf "dependency. To repair the\n" 6867836SJohn.Forte@Sun.COM printf "problem, run \"dscfgadm\".\n" 6877836SJohn.Forte@Sun.COM fi 6887836SJohn.Forte@Sun.COM} 6897836SJohn.Forte@Sun.COM 6907836SJohn.Forte@Sun.COM# 6917836SJohn.Forte@Sun.COM# initialize the local configuration database (only called if none exists) 6927836SJohn.Forte@Sun.COM# returns 0 if successful, 1 if failed 6937836SJohn.Forte@Sun.COM# 6947836SJohn.Forte@Sun.COMinitialize_local_db() 6957836SJohn.Forte@Sun.COM{ 6967836SJohn.Forte@Sun.COM $xopt 6977836SJohn.Forte@Sun.COM 6987836SJohn.Forte@Sun.COM echo "Could not find a valid local configuration database." 6997836SJohn.Forte@Sun.COM echo "Initializing local configuration database..." 7007836SJohn.Forte@Sun.COM echo y | ${DSCFG} -i > /dev/null 2>&1 7017836SJohn.Forte@Sun.COM ${DSCFG} -i -p ${PCONFIG} > /dev/null 2>&1 7027836SJohn.Forte@Sun.COM 7037836SJohn.Forte@Sun.COM # Make sure the new location is initialized properly 7047836SJohn.Forte@Sun.COM valid_local_dscfg_exists 7057836SJohn.Forte@Sun.COM VALID_LOCAL_DB=$? 7067836SJohn.Forte@Sun.COM if [ $VALID_LOCAL_DB != 1 ] 7077836SJohn.Forte@Sun.COM then 7087836SJohn.Forte@Sun.COM echo "Unable to initialize local configuration database" >&2 7097836SJohn.Forte@Sun.COM return 1 7107836SJohn.Forte@Sun.COM else 7117836SJohn.Forte@Sun.COM echo "Successfully initialized local configuration database" 7127836SJohn.Forte@Sun.COM fi 7137836SJohn.Forte@Sun.COM 7147836SJohn.Forte@Sun.COM return 0 7157836SJohn.Forte@Sun.COM} 7167836SJohn.Forte@Sun.COM 7177836SJohn.Forte@Sun.COM# 7187836SJohn.Forte@Sun.COM# initialize the cluster configuration database, if necessary 7197836SJohn.Forte@Sun.COM# returns 0 if successful, 1 if failed 7207836SJohn.Forte@Sun.COM# 7217836SJohn.Forte@Sun.COMinitialize_cluster_db() 7227836SJohn.Forte@Sun.COM{ 7237836SJohn.Forte@Sun.COM $xopt 7247836SJohn.Forte@Sun.COM 7257836SJohn.Forte@Sun.COM if [ ! -n "$FILE_LOC" ] 7267836SJohn.Forte@Sun.COM then 7277836SJohn.Forte@Sun.COM return 0 7287836SJohn.Forte@Sun.COM fi 7297836SJohn.Forte@Sun.COM 7307836SJohn.Forte@Sun.COM echo "Initializing cluster configuration database..." 7317836SJohn.Forte@Sun.COM ${DSCFG} -s ${FILE_LOC} -C $CTAG_NULL > /dev/null 2>&1 7327836SJohn.Forte@Sun.COM echo y | ${DSCFG} -i -C $CTAG_NULL > /dev/null 2>&1 7337836SJohn.Forte@Sun.COM ${DSCFG} -i -p ${PCONFIG} -C $CTAG_NULL > /dev/null 2>&1 7347836SJohn.Forte@Sun.COM 7357836SJohn.Forte@Sun.COM # make sure the cluster db is valid now 7367836SJohn.Forte@Sun.COM valid_cluster_dscfg_exists 7377836SJohn.Forte@Sun.COM VALID_CLUSTER_DB=$? 7387836SJohn.Forte@Sun.COM if [ $VALID_CLUSTER_DB != 1 ] 7397836SJohn.Forte@Sun.COM then 7407836SJohn.Forte@Sun.COM echo "Unable to initialize cluster configuration database" >&2 7417836SJohn.Forte@Sun.COM return 1 7427836SJohn.Forte@Sun.COM else 7437836SJohn.Forte@Sun.COM echo "Successfully initialized cluster configuration database" 7447836SJohn.Forte@Sun.COM fi 7457836SJohn.Forte@Sun.COM 7467836SJohn.Forte@Sun.COM return 0 7477836SJohn.Forte@Sun.COM 7487836SJohn.Forte@Sun.COM} 7497836SJohn.Forte@Sun.COM 7507836SJohn.Forte@Sun.COM# 7517836SJohn.Forte@Sun.COM# prompt the user for a config location and set AVS to use that location 7527836SJohn.Forte@Sun.COM# 7537836SJohn.Forte@Sun.COMset_cluster_config() 7547836SJohn.Forte@Sun.COM{ 7557836SJohn.Forte@Sun.COM 7567836SJohn.Forte@Sun.COM$xopt 7577836SJohn.Forte@Sun.COM 7587836SJohn.Forte@Sun.COMREPEAT=0 7597836SJohn.Forte@Sun.COMwhile [ $REPEAT -eq 0 ]; do 7607836SJohn.Forte@Sun.COM # See if user has entered location already, and it was an existing 7617836SJohn.Forte@Sun.COM # db. Retruns FILE_LOC value 7627836SJohn.Forte@Sun.COM if [ $VALID_DB_ENTERED = 1 ]; then 7637836SJohn.Forte@Sun.COM 7647836SJohn.Forte@Sun.COM # reset 7657836SJohn.Forte@Sun.COM VALID_DB_ENTERED=0 7667836SJohn.Forte@Sun.COM preserve_overwrite_maybe 7677836SJohn.Forte@Sun.COM 7687836SJohn.Forte@Sun.COM # if 1, location passes, and FILE_LOC being passed to end, else 7697836SJohn.Forte@Sun.COM # set VALID_CLUSTER_DB to 0 since the "valid one" isn't valid anymore 7707836SJohn.Forte@Sun.COM # (bad size, etc) thereby when looping go straight to get_location 7717836SJohn.Forte@Sun.COM if [ $? = 1 ]; then 7727836SJohn.Forte@Sun.COM REPEAT=1 7737836SJohn.Forte@Sun.COM continue 7747836SJohn.Forte@Sun.COM else 7757836SJohn.Forte@Sun.COM VALID_CLUSTER_DB=0 7767836SJohn.Forte@Sun.COM continue 7777836SJohn.Forte@Sun.COM fi 7787836SJohn.Forte@Sun.COM fi 7797836SJohn.Forte@Sun.COM 7807836SJohn.Forte@Sun.COM # if 1, then valid db exists, now see what user wants to do 7817836SJohn.Forte@Sun.COM if [ $VALID_CLUSTER_DB = 1 ]; then 7827836SJohn.Forte@Sun.COM SAFE_LOC=$FILE_LOC 7837836SJohn.Forte@Sun.COM keep_it 7847836SJohn.Forte@Sun.COM 7857836SJohn.Forte@Sun.COM # if 0, then user can't or won't keep location. set PROMPT 7867836SJohn.Forte@Sun.COM # so we will get new location from user. 7877836SJohn.Forte@Sun.COM if [ $? = 0 ]; then 7887836SJohn.Forte@Sun.COM PROMPT=0 7897836SJohn.Forte@Sun.COM else 7907836SJohn.Forte@Sun.COM PROMPT=1 7917836SJohn.Forte@Sun.COM fi 7927836SJohn.Forte@Sun.COM fi 7937836SJohn.Forte@Sun.COM 7947836SJohn.Forte@Sun.COM # if either are 0, then user wants or needs new db as outlined in 7957836SJohn.Forte@Sun.COM # earlier comments 7967836SJohn.Forte@Sun.COM if [ $VALID_CLUSTER_DB = 0 ] || [ $PROMPT = 0 ]; then 7977836SJohn.Forte@Sun.COM # 7987836SJohn.Forte@Sun.COM # We cannot proceed if the services are running. Give the user 7997836SJohn.Forte@Sun.COM # a chance to stop the services. If he chooses not to, bail. 8007836SJohn.Forte@Sun.COM # 8017836SJohn.Forte@Sun.COM check_enabled 8027836SJohn.Forte@Sun.COM if [ $? = 1 ] 8037836SJohn.Forte@Sun.COM then 8047836SJohn.Forte@Sun.COM show_enabled 8057836SJohn.Forte@Sun.COM ask_to_disable 8067836SJohn.Forte@Sun.COM if [ $? = 0 ] 8077836SJohn.Forte@Sun.COM then 8087836SJohn.Forte@Sun.COM echo "A new configuration location was not set." 8097836SJohn.Forte@Sun.COM exit 1 8107836SJohn.Forte@Sun.COM else 8117836SJohn.Forte@Sun.COM disable_services 8127836SJohn.Forte@Sun.COM if [ $? != 0 ] 8137836SJohn.Forte@Sun.COM then 8147836SJohn.Forte@Sun.COM exit 1 8157836SJohn.Forte@Sun.COM fi 8167836SJohn.Forte@Sun.COM fi 8177836SJohn.Forte@Sun.COM 8187836SJohn.Forte@Sun.COM fi 8197836SJohn.Forte@Sun.COM 8207836SJohn.Forte@Sun.COM get_location 8217836SJohn.Forte@Sun.COM contains_data $FILE_LOC 8227836SJohn.Forte@Sun.COM 8237836SJohn.Forte@Sun.COM # if 1, then user entered an existsing db location, loop 8247836SJohn.Forte@Sun.COM # back to ask what to do with it 8257836SJohn.Forte@Sun.COM if [ $? = 1 ]; then 8267836SJohn.Forte@Sun.COM VALID_DB_ENTERED=1 8277836SJohn.Forte@Sun.COM continue 8287836SJohn.Forte@Sun.COM else 8297836SJohn.Forte@Sun.COM check_location $FILE_LOC 8307836SJohn.Forte@Sun.COM 8317836SJohn.Forte@Sun.COM # if 0, that means location has failed, loop and 8327836SJohn.Forte@Sun.COM # get_location again 8337836SJohn.Forte@Sun.COM if [ $? = 0 ]; then 8347836SJohn.Forte@Sun.COM VALID_CLUSTER_DB=0 8357836SJohn.Forte@Sun.COM continue 8367836SJohn.Forte@Sun.COM fi 8377836SJohn.Forte@Sun.COM # entered location passes tests 8387836SJohn.Forte@Sun.COM REPEAT=1 8397836SJohn.Forte@Sun.COM continue 8407836SJohn.Forte@Sun.COM fi 8417836SJohn.Forte@Sun.COM else 8427836SJohn.Forte@Sun.COM # user wants to leave location where and how it is 8437836SJohn.Forte@Sun.COM # FILE_LOC being passed all the way to end 8447836SJohn.Forte@Sun.COM REPEAT=1 8457836SJohn.Forte@Sun.COM continue 8467836SJohn.Forte@Sun.COM fi 8477836SJohn.Forte@Sun.COMdone 8487836SJohn.Forte@Sun.COM 8497836SJohn.Forte@Sun.COM} 8507836SJohn.Forte@Sun.COM 8517836SJohn.Forte@Sun.COM########################## MAIN FUNCTIONS ############################ 8527836SJohn.Forte@Sun.COM 8537836SJohn.Forte@Sun.COM######################## SMF HELPER FUNCTIONS ######################## 8547836SJohn.Forte@Sun.COM# 8557836SJohn.Forte@Sun.COM# check if any SMF service is online (enabled) 8567836SJohn.Forte@Sun.COM# 8577836SJohn.Forte@Sun.COMcheck_enabled() 8587836SJohn.Forte@Sun.COM{ 8597836SJohn.Forte@Sun.COM $xopt 8607836SJohn.Forte@Sun.COM typeset ret=0 8617836SJohn.Forte@Sun.COM typeset svc 8627836SJohn.Forte@Sun.COM 8637836SJohn.Forte@Sun.COM for svc in $SMF_ENABLE 8647836SJohn.Forte@Sun.COM do 8657836SJohn.Forte@Sun.COM is_enabled $svc 8667836SJohn.Forte@Sun.COM eval ${svc}_enabled=$? 8677836SJohn.Forte@Sun.COM ret=$((ret | ${svc}_enabled)) 8687836SJohn.Forte@Sun.COM done 8697836SJohn.Forte@Sun.COM 8707836SJohn.Forte@Sun.COM return $ret 8717836SJohn.Forte@Sun.COM} 8727836SJohn.Forte@Sun.COM 8737836SJohn.Forte@Sun.COM# 8747836SJohn.Forte@Sun.COM# Display which services are enabled. (Must be called after check_enabled) 8757836SJohn.Forte@Sun.COM# 8767836SJohn.Forte@Sun.COMshow_enabled() 8777836SJohn.Forte@Sun.COM{ 8787836SJohn.Forte@Sun.COM $xopt 8797836SJohn.Forte@Sun.COM typeset svc 8807836SJohn.Forte@Sun.COM 8817836SJohn.Forte@Sun.COM echo "\nThe following Availability Suite services are enabled:" 8827836SJohn.Forte@Sun.COM 8837836SJohn.Forte@Sun.COM for svc in $SMF_ENABLE 8847836SJohn.Forte@Sun.COM do 8857836SJohn.Forte@Sun.COM if (( ${svc}_enabled == 1 )) 8867836SJohn.Forte@Sun.COM then 8877836SJohn.Forte@Sun.COM printf "$svc " 8887836SJohn.Forte@Sun.COM fi 8897836SJohn.Forte@Sun.COM done 8907836SJohn.Forte@Sun.COM 8917836SJohn.Forte@Sun.COM echo "" 8927836SJohn.Forte@Sun.COM} 8937836SJohn.Forte@Sun.COM 8947836SJohn.Forte@Sun.COM 8957836SJohn.Forte@Sun.COM# 8967836SJohn.Forte@Sun.COM# check if the given SMF service is online (enabled) 8977836SJohn.Forte@Sun.COM# 8987836SJohn.Forte@Sun.COM# $1: service name to check for 8997836SJohn.Forte@Sun.COM# 9007836SJohn.Forte@Sun.COMis_enabled() 9017836SJohn.Forte@Sun.COM{ 9027836SJohn.Forte@Sun.COM $xopt 9037836SJohn.Forte@Sun.COM typeset en 9047836SJohn.Forte@Sun.COM 9057836SJohn.Forte@Sun.COM is_imported $1 9067836SJohn.Forte@Sun.COM if [ $? = 1 ] 9077836SJohn.Forte@Sun.COM then 9087836SJohn.Forte@Sun.COM en=`svcprop -c -p general/enabled svc:/system/${1}:default` 9097836SJohn.Forte@Sun.COM if [ $en = "true" ] 9107836SJohn.Forte@Sun.COM then 9117836SJohn.Forte@Sun.COM return 1 9127836SJohn.Forte@Sun.COM fi 9137836SJohn.Forte@Sun.COM fi 9147836SJohn.Forte@Sun.COM 9157836SJohn.Forte@Sun.COM return 0 9167836SJohn.Forte@Sun.COM 9177836SJohn.Forte@Sun.COM} 9187836SJohn.Forte@Sun.COM 9197836SJohn.Forte@Sun.COM# 9207836SJohn.Forte@Sun.COM# If necessary, flag no dependency check 9217836SJohn.Forte@Sun.COM# 9227836SJohn.Forte@Sun.COMno_depend_check() 9237836SJohn.Forte@Sun.COM{ 9247836SJohn.Forte@Sun.COM $xopt 9257836SJohn.Forte@Sun.COM typeset pid 9267836SJohn.Forte@Sun.COM typeset msg=0 9277836SJohn.Forte@Sun.COM 9287836SJohn.Forte@Sun.COM if [ $OS_MINOR -lt 11 ] 9297836SJohn.Forte@Sun.COM then 9307836SJohn.Forte@Sun.COM if [ -f $DSCFG_DEPEND_NOCHK ] 9317836SJohn.Forte@Sun.COM then 9327836SJohn.Forte@Sun.COM pid=`cat $DSCFG_DEPEND_NOCHK` 9337836SJohn.Forte@Sun.COM echo "Another dscfgadm disable is in progress." 9347836SJohn.Forte@Sun.COM echo "Waiting for pid: $pid to terminate..." 9357836SJohn.Forte@Sun.COM 9367836SJohn.Forte@Sun.COM while [ -f $DSCFG_DEPEND_NOCHK ] 9377836SJohn.Forte@Sun.COM do 9387836SJohn.Forte@Sun.COM if (( msg && (msg % 6 == 0))) 9397836SJohn.Forte@Sun.COM then 9407836SJohn.Forte@Sun.COM printf "\nAnother dscfgadm disable " 9417836SJohn.Forte@Sun.COM printf "(pid: $pid) still appears to " 9427836SJohn.Forte@Sun.COM printf " be in progress.\n" 9437836SJohn.Forte@Sun.COM printf "If this is not the case, you " 9447836SJohn.Forte@Sun.COM printf "may remove " 9457836SJohn.Forte@Sun.COM printf "$DSCFG_DEPEND_NOCHK.\n" 9467836SJohn.Forte@Sun.COM fi 9477836SJohn.Forte@Sun.COM sleep 5 9487836SJohn.Forte@Sun.COM msg=$((msg + 1)) 9497836SJohn.Forte@Sun.COM done 9507836SJohn.Forte@Sun.COM fi 9517836SJohn.Forte@Sun.COM 9527836SJohn.Forte@Sun.COM touch $DSCFG_DEPEND_NOCHK 9537836SJohn.Forte@Sun.COM echo $$ >> $DSCFG_DEPEND_NOCHK 9547836SJohn.Forte@Sun.COM fi 9557836SJohn.Forte@Sun.COM} 9567836SJohn.Forte@Sun.COM 9577836SJohn.Forte@Sun.COM# 9587836SJohn.Forte@Sun.COM# If necessary, remove the no dependency check flag 9597836SJohn.Forte@Sun.COM# 9607836SJohn.Forte@Sun.COMrm_no_depend_check() 9617836SJohn.Forte@Sun.COM{ 9627836SJohn.Forte@Sun.COM $xopt 9637836SJohn.Forte@Sun.COM if [ $OS_MINOR -lt 11 ] 9647836SJohn.Forte@Sun.COM then 9657836SJohn.Forte@Sun.COM rm -f $DSCFG_DEPEND_NOCHK 9667836SJohn.Forte@Sun.COM fi 9677836SJohn.Forte@Sun.COM} 9687836SJohn.Forte@Sun.COM 9697836SJohn.Forte@Sun.COM# 9707836SJohn.Forte@Sun.COM# set the filesystem/local dependency type and refresh 9717836SJohn.Forte@Sun.COM# 9727836SJohn.Forte@Sun.COM# $1: service name 9737836SJohn.Forte@Sun.COM# $2: either "require_all" or "optional_all" 9747836SJohn.Forte@Sun.COM# 9757836SJohn.Forte@Sun.COMset_fs_local_grouping() 9767836SJohn.Forte@Sun.COM{ 9777836SJohn.Forte@Sun.COM $xopt 9787836SJohn.Forte@Sun.COM typeset svc=$1 9797836SJohn.Forte@Sun.COM typeset dep_group=$2 9807836SJohn.Forte@Sun.COM 9817836SJohn.Forte@Sun.COM # set proper dependency type for fs-local 9827836SJohn.Forte@Sun.COM if [ $svc != nws_rdcsyncd ]; then 9837836SJohn.Forte@Sun.COM svccfg -s $FS_LOCAL_SVC setprop \ 9847836SJohn.Forte@Sun.COM ${svc}-local-fs/grouping=$dep_group 9857836SJohn.Forte@Sun.COM if [ $? -ne 0 ] 9867836SJohn.Forte@Sun.COM then 9877836SJohn.Forte@Sun.COM printf "command failed: svccfg -s $FS_LOCAL_SVC " 9887836SJohn.Forte@Sun.COM printf "setprop ${svc}-local-fs/grouping=$dep_group " 9897836SJohn.Forte@Sun.COM printf ">&2\n" 9907836SJohn.Forte@Sun.COM return 1 9917836SJohn.Forte@Sun.COM fi 9927836SJohn.Forte@Sun.COM 9937836SJohn.Forte@Sun.COM # we need local-fs to know about the new grouping attributes 9947836SJohn.Forte@Sun.COM svcadm refresh ${FS_LOCAL_SVC}:default 9957836SJohn.Forte@Sun.COM if [ $? -ne 0 ] 9967836SJohn.Forte@Sun.COM then 9977836SJohn.Forte@Sun.COM print "Failed to refresh ${FS_LOCAL_SVC} >&2" 9987836SJohn.Forte@Sun.COM return 1 9997836SJohn.Forte@Sun.COM fi 10007836SJohn.Forte@Sun.COM fi 10017836SJohn.Forte@Sun.COM 10027836SJohn.Forte@Sun.COM return 0 10037836SJohn.Forte@Sun.COM} 10047836SJohn.Forte@Sun.COM 10057836SJohn.Forte@Sun.COM# 10067836SJohn.Forte@Sun.COM# check if the grouping dependency type for filesystem/local is correct 10077836SJohn.Forte@Sun.COM# 10087836SJohn.Forte@Sun.COM# input: 10097836SJohn.Forte@Sun.COM# $1: service name 10107836SJohn.Forte@Sun.COM# 10117836SJohn.Forte@Sun.COM# returns: 10127836SJohn.Forte@Sun.COM# 0 if the setting is correct 10137836SJohn.Forte@Sun.COM# 1 if the setting is incorrect 10147836SJohn.Forte@Sun.COM# outputs: sets CORRECT_GROUPING with the value of what the grouping should be. 10157836SJohn.Forte@Sun.COM# 10167836SJohn.Forte@Sun.COMcheck_fs_local_grouping() 10177836SJohn.Forte@Sun.COM{ 10187836SJohn.Forte@Sun.COM $xopt 10197836SJohn.Forte@Sun.COM typeset svc=$1 10207836SJohn.Forte@Sun.COM typeset cur_grouping 10217836SJohn.Forte@Sun.COM 10227836SJohn.Forte@Sun.COM if [ $svc = nws_rdcsyncd ] 10237836SJohn.Forte@Sun.COM then 10247836SJohn.Forte@Sun.COM return 0 10257836SJohn.Forte@Sun.COM fi 10267836SJohn.Forte@Sun.COM 10277836SJohn.Forte@Sun.COM # If it's not imported, we just return success, since we don't want 10287836SJohn.Forte@Sun.COM # further processing 10297836SJohn.Forte@Sun.COM is_imported $svc 10307836SJohn.Forte@Sun.COM if [ $? = 0 ] 10317836SJohn.Forte@Sun.COM then 10327836SJohn.Forte@Sun.COM return 0 10337836SJohn.Forte@Sun.COM fi 10347836SJohn.Forte@Sun.COM 10357836SJohn.Forte@Sun.COM # get the current grouping value from the repository 10367836SJohn.Forte@Sun.COM cur_grouping=`svcprop -c -p ${svc}-local-fs/grouping $FS_LOCAL_SVC` 10377836SJohn.Forte@Sun.COM 10387836SJohn.Forte@Sun.COM # Figure out what the grouping should be (based on enabled status) 10397836SJohn.Forte@Sun.COM is_enabled $svc 10407836SJohn.Forte@Sun.COM if [ $? = 1 ] 10417836SJohn.Forte@Sun.COM then 10427836SJohn.Forte@Sun.COM CORRECT_GROUPING="require_all" 10437836SJohn.Forte@Sun.COM else 10447836SJohn.Forte@Sun.COM CORRECT_GROUPING="optional_all" 10457836SJohn.Forte@Sun.COM fi 10467836SJohn.Forte@Sun.COM 10477836SJohn.Forte@Sun.COM if [ "$cur_grouping" != "$CORRECT_GROUPING" ] 10487836SJohn.Forte@Sun.COM then 10497836SJohn.Forte@Sun.COM # grouping is incorrect 10507836SJohn.Forte@Sun.COM return 1 10517836SJohn.Forte@Sun.COM else 10527836SJohn.Forte@Sun.COM # grouping is just fine 10537836SJohn.Forte@Sun.COM return 0 10547836SJohn.Forte@Sun.COM fi 10557836SJohn.Forte@Sun.COM} 10567836SJohn.Forte@Sun.COM 10577836SJohn.Forte@Sun.COM# 10587836SJohn.Forte@Sun.COM# enable/disable the given SMF service. Also, update the filesystem-local 10597836SJohn.Forte@Sun.COM# dependency, if appropriate. 10607836SJohn.Forte@Sun.COM# 10617836SJohn.Forte@Sun.COM# $1: service name to check for 10627836SJohn.Forte@Sun.COM# $2: "enable" or "disable" 10637836SJohn.Forte@Sun.COM# 10647836SJohn.Forte@Sun.COMsvc_operation() 10657836SJohn.Forte@Sun.COM{ 10667836SJohn.Forte@Sun.COM $xopt 10677836SJohn.Forte@Sun.COM typeset svc=$1 10687836SJohn.Forte@Sun.COM typeset command=$2 10697836SJohn.Forte@Sun.COM typeset enable_state 10707836SJohn.Forte@Sun.COM typeset dep_group 10717836SJohn.Forte@Sun.COM 10727836SJohn.Forte@Sun.COM # If disabling, then enable_state better be true, and we are 10737836SJohn.Forte@Sun.COM # transitioning to "option_all" grouping 10747836SJohn.Forte@Sun.COM if [ $command = "disable" ] 10757836SJohn.Forte@Sun.COM then 10767836SJohn.Forte@Sun.COM enable_state=1 10777836SJohn.Forte@Sun.COM dep_group="optional_all" 10787836SJohn.Forte@Sun.COM 10797836SJohn.Forte@Sun.COM # If enabling, then enable_state better be false, and we are 10807836SJohn.Forte@Sun.COM # transitioning to "require_all" grouping 10817836SJohn.Forte@Sun.COM elif [ $command = "enable" ] 10827836SJohn.Forte@Sun.COM then 10837836SJohn.Forte@Sun.COM enable_state=0 10847836SJohn.Forte@Sun.COM dep_group="require_all" 10857836SJohn.Forte@Sun.COM else 10867836SJohn.Forte@Sun.COM echo "invalid command: $command" >&2 10877836SJohn.Forte@Sun.COM fi 10887836SJohn.Forte@Sun.COM 10897836SJohn.Forte@Sun.COM is_imported $svc 10907836SJohn.Forte@Sun.COM if [ $? = 1 ] 10917836SJohn.Forte@Sun.COM then 10927836SJohn.Forte@Sun.COM is_enabled $svc 10937836SJohn.Forte@Sun.COM if [ $? = $enable_state ] 10947836SJohn.Forte@Sun.COM then 10957836SJohn.Forte@Sun.COM if [ $enable_state -eq 1 ] 10967836SJohn.Forte@Sun.COM then 10977836SJohn.Forte@Sun.COM # we're doing a disable--remove hard dependency 10987836SJohn.Forte@Sun.COM set_fs_local_grouping $svc $dep_group 10997836SJohn.Forte@Sun.COM if [ $? -ne 0 ] 11007836SJohn.Forte@Sun.COM then 11017836SJohn.Forte@Sun.COM return 1 11027836SJohn.Forte@Sun.COM fi 11037836SJohn.Forte@Sun.COM fi 11047836SJohn.Forte@Sun.COM 11057836SJohn.Forte@Sun.COM svcadm $command -s svc:/system/$svc 11067836SJohn.Forte@Sun.COM if [ $? != 0 ] 11077836SJohn.Forte@Sun.COM then 11087836SJohn.Forte@Sun.COM echo "$svc failed to $command" >&2 11097836SJohn.Forte@Sun.COM return 1 11107836SJohn.Forte@Sun.COM fi 11117836SJohn.Forte@Sun.COM 11127836SJohn.Forte@Sun.COM if [ $enable_state -eq 0 ] 11137836SJohn.Forte@Sun.COM then 11147836SJohn.Forte@Sun.COM # we just did an enable--create hard dependency 11157836SJohn.Forte@Sun.COM set_fs_local_grouping $svc $dep_group 11167836SJohn.Forte@Sun.COM if [ $? -ne 0 ] 11177836SJohn.Forte@Sun.COM then 11187836SJohn.Forte@Sun.COM return 1 11197836SJohn.Forte@Sun.COM fi 11207836SJohn.Forte@Sun.COM fi 11217836SJohn.Forte@Sun.COM 11227836SJohn.Forte@Sun.COM else 11237836SJohn.Forte@Sun.COM echo "$svc service already ${command}d... skipping" 11247836SJohn.Forte@Sun.COM fi 11257836SJohn.Forte@Sun.COM fi 11267836SJohn.Forte@Sun.COM 11277836SJohn.Forte@Sun.COM return 0 11287836SJohn.Forte@Sun.COM} 11297836SJohn.Forte@Sun.COM 11307836SJohn.Forte@Sun.COM# 11317836SJohn.Forte@Sun.COM# This chart summarizes the behavior of the -r and -p sub-options for the 11327836SJohn.Forte@Sun.COM# -e and -d options. 11337836SJohn.Forte@Sun.COM# There are 5 possible states, and 5 transitions out of each state. 11347836SJohn.Forte@Sun.COM# 11357836SJohn.Forte@Sun.COM# states: (vertical axis) 11367836SJohn.Forte@Sun.COM# ------- 11377836SJohn.Forte@Sun.COM# 0: no services enabled 11387836SJohn.Forte@Sun.COM# C: one or both core services enabled (illegal state) 11397836SJohn.Forte@Sun.COM# R: both core services and RM services enabled 11407836SJohn.Forte@Sun.COM# P: both core services and PITC service enabled 11417836SJohn.Forte@Sun.COM# A: all services enabled 11427836SJohn.Forte@Sun.COM# 11437836SJohn.Forte@Sun.COM# transitions: (horizontal axis) 11447836SJohn.Forte@Sun.COM# ------------ 11457836SJohn.Forte@Sun.COM# +/-a: enable/disable, respectively, with neither -r nor -p 11467836SJohn.Forte@Sun.COM# +/-r: enable/disable, respectively, with -r flag 11477836SJohn.Forte@Sun.COM# +p: enable with -p flag 11487836SJohn.Forte@Sun.COM# 11497836SJohn.Forte@Sun.COM# The result of the function is the next state after the action has been 11507836SJohn.Forte@Sun.COM# successfully performed. 11517836SJohn.Forte@Sun.COM# 11527836SJohn.Forte@Sun.COM# +a | -a | +r | -r | +p | 11537836SJohn.Forte@Sun.COM# ++----+----+----+----+----+ 11547836SJohn.Forte@Sun.COM# ++----+----+----+----+----+ 11557836SJohn.Forte@Sun.COM# 0 || A | 0* | R | 0* | P | 11567836SJohn.Forte@Sun.COM# --++----+----+----+----+----+ 11577836SJohn.Forte@Sun.COM# C || A* | 0* | R | 0 | P | 11587836SJohn.Forte@Sun.COM# --++----+----+----+----+----+ 11597836SJohn.Forte@Sun.COM# R || A* | 0* | R* | 0 | A | 11607836SJohn.Forte@Sun.COM# --++----+----+----+----+----+ 11617836SJohn.Forte@Sun.COM# P || A* | 0* | A* | P* | P* | 11627836SJohn.Forte@Sun.COM# --++----+----+----+----+----+ 11637836SJohn.Forte@Sun.COM# A || A* | 0 | A* | P | A* | 11647836SJohn.Forte@Sun.COM# --++----+----+----+----+----+ 11657836SJohn.Forte@Sun.COM# 11667836SJohn.Forte@Sun.COM# *: warning message is displayed, stating that a service is already 11677836SJohn.Forte@Sun.COM# enabled/disabled. 11687836SJohn.Forte@Sun.COM# 11697836SJohn.Forte@Sun.COM 11707836SJohn.Forte@Sun.COM# enable the SMF services needed for the Availability Suite 11717836SJohn.Forte@Sun.COM# 11727836SJohn.Forte@Sun.COMenable_services() 11737836SJohn.Forte@Sun.COM{ 11747836SJohn.Forte@Sun.COM $xopt 11757836SJohn.Forte@Sun.COM typeset svc 11767836SJohn.Forte@Sun.COM 11777836SJohn.Forte@Sun.COM # first, import them if they have not yet been imported 11787836SJohn.Forte@Sun.COM import_services 11797836SJohn.Forte@Sun.COM 11807836SJohn.Forte@Sun.COM # if neither r_flag nor p_flag is set, enable all services 11817836SJohn.Forte@Sun.COM if (( (r_flag | p_flag) == 0 )) 11827836SJohn.Forte@Sun.COM then 11837836SJohn.Forte@Sun.COM for svc in $SMF_ENABLE 11847836SJohn.Forte@Sun.COM do 11857836SJohn.Forte@Sun.COM if ! svc_operation $svc enable 11867836SJohn.Forte@Sun.COM then 11877836SJohn.Forte@Sun.COM return 1 11887836SJohn.Forte@Sun.COM fi 11897836SJohn.Forte@Sun.COM done 11907836SJohn.Forte@Sun.COM else 11917836SJohn.Forte@Sun.COM # figure out which services are enabled 11927836SJohn.Forte@Sun.COM check_enabled 11937836SJohn.Forte@Sun.COM 11947836SJohn.Forte@Sun.COM # First, make sure both core services are enabled 11957836SJohn.Forte@Sun.COM for svc in nws_scm nws_sv 11967836SJohn.Forte@Sun.COM do 11977836SJohn.Forte@Sun.COM if (( ${svc}_enabled == 0 )) && \ 11987836SJohn.Forte@Sun.COM ! svc_operation $svc enable 11997836SJohn.Forte@Sun.COM then 12007836SJohn.Forte@Sun.COM return 1 12017836SJohn.Forte@Sun.COM fi 12027836SJohn.Forte@Sun.COM done 12037836SJohn.Forte@Sun.COM 12047836SJohn.Forte@Sun.COM if ((p_flag)) 12057836SJohn.Forte@Sun.COM then 12067836SJohn.Forte@Sun.COM if ! svc_operation nws_ii enable 12077836SJohn.Forte@Sun.COM then 12087836SJohn.Forte@Sun.COM return 1 12097836SJohn.Forte@Sun.COM fi 12107836SJohn.Forte@Sun.COM fi 12117836SJohn.Forte@Sun.COM 12127836SJohn.Forte@Sun.COM if ((r_flag)) 12137836SJohn.Forte@Sun.COM then 12147836SJohn.Forte@Sun.COM for svc in nws_rdc nws_rdcsyncd 12157836SJohn.Forte@Sun.COM do 12167836SJohn.Forte@Sun.COM if ! svc_operation $svc enable 12177836SJohn.Forte@Sun.COM then 12187836SJohn.Forte@Sun.COM return 1 12197836SJohn.Forte@Sun.COM fi 12207836SJohn.Forte@Sun.COM done 12217836SJohn.Forte@Sun.COM fi 12227836SJohn.Forte@Sun.COM 12237836SJohn.Forte@Sun.COM fi 12247836SJohn.Forte@Sun.COM 12257836SJohn.Forte@Sun.COM return 0 12267836SJohn.Forte@Sun.COM} 12277836SJohn.Forte@Sun.COM 12287836SJohn.Forte@Sun.COM# 12297836SJohn.Forte@Sun.COM# disable the SMF services needed for the Availability Suite 12307836SJohn.Forte@Sun.COM# 12317836SJohn.Forte@Sun.COMdisable_services() 12327836SJohn.Forte@Sun.COM{ 12337836SJohn.Forte@Sun.COM $xopt 12347836SJohn.Forte@Sun.COM typeset svc 12357836SJohn.Forte@Sun.COM 12367836SJohn.Forte@Sun.COM check_device_groups 12377836SJohn.Forte@Sun.COM if [ $? == 1 ] 12387836SJohn.Forte@Sun.COM then 12397836SJohn.Forte@Sun.COM return 1 12407836SJohn.Forte@Sun.COM fi 12417836SJohn.Forte@Sun.COM 12427836SJohn.Forte@Sun.COM # This flags the shutdown scripts to not check to make sure the 12437836SJohn.Forte@Sun.COM # services' dependents have been disabled. The flag must be removed 12447836SJohn.Forte@Sun.COM # before returning from this function. 12457836SJohn.Forte@Sun.COM no_depend_check 12467836SJohn.Forte@Sun.COM 12477836SJohn.Forte@Sun.COM # NB: p_flag is not allowed for disables. II should not be 12487836SJohn.Forte@Sun.COM # disabled if sndr is enabled. If rdc is not enabled, disabling just 12497836SJohn.Forte@Sun.COM # II is equivalent to disabling all the remaining services. 12507836SJohn.Forte@Sun.COM 12517836SJohn.Forte@Sun.COM # If no flags passed in, just disable everything 12527836SJohn.Forte@Sun.COM if (( r_flag == 0 )) 12537836SJohn.Forte@Sun.COM then 12547836SJohn.Forte@Sun.COM for svc in $SMF_DISABLE 12557836SJohn.Forte@Sun.COM do 12567836SJohn.Forte@Sun.COM if ! svc_operation $svc disable 12577836SJohn.Forte@Sun.COM then 12587836SJohn.Forte@Sun.COM rm_no_depend_check 12597836SJohn.Forte@Sun.COM return 1 12607836SJohn.Forte@Sun.COM fi 12617836SJohn.Forte@Sun.COM done 12627836SJohn.Forte@Sun.COM 12637836SJohn.Forte@Sun.COM # Now that we've disable the services, lets unload them 12647836SJohn.Forte@Sun.COM # from the Solaris kernel 12657836SJohn.Forte@Sun.COM # 12667836SJohn.Forte@Sun.COM modinfo | grep '(nws:' | grep -v "kRPC Stub" | sort -r | cut -d' ' -f1 | xargs -l modunload -i 2>/dev/null 12677836SJohn.Forte@Sun.COM modinfo | grep '(nws:' | grep -v "kRPC Stub" | sort -r | cut -d' ' -f1 | xargs -l modunload -i 2>/dev/null 12687836SJohn.Forte@Sun.COM else 12697836SJohn.Forte@Sun.COM # we're disabling just rdc. If II is not already enabled, 12707836SJohn.Forte@Sun.COM # we disable core services, as well. 12717836SJohn.Forte@Sun.COM 12727836SJohn.Forte@Sun.COM # figure out which services are enabled 12737836SJohn.Forte@Sun.COM check_enabled 12747836SJohn.Forte@Sun.COM 12757836SJohn.Forte@Sun.COM for svc in nws_rdcsyncd nws_rdc 12767836SJohn.Forte@Sun.COM do 12777836SJohn.Forte@Sun.COM if ! svc_operation $svc disable 12787836SJohn.Forte@Sun.COM then 12797836SJohn.Forte@Sun.COM rm_no_depend_check 12807836SJohn.Forte@Sun.COM return 1 12817836SJohn.Forte@Sun.COM fi 12827836SJohn.Forte@Sun.COM done 12837836SJohn.Forte@Sun.COM 12847836SJohn.Forte@Sun.COM if (( nws_ii_enabled == 0 )) 12857836SJohn.Forte@Sun.COM then 12867836SJohn.Forte@Sun.COM for svc in nws_sv nws_scm 12877836SJohn.Forte@Sun.COM do 12887836SJohn.Forte@Sun.COM if ((${svc}_enabled)) && \ 12897836SJohn.Forte@Sun.COM ! svc_operation $svc disable 12907836SJohn.Forte@Sun.COM then 12917836SJohn.Forte@Sun.COM rm_no_depend_check 12927836SJohn.Forte@Sun.COM return 1 12937836SJohn.Forte@Sun.COM fi 12947836SJohn.Forte@Sun.COM done 12957836SJohn.Forte@Sun.COM fi 12967836SJohn.Forte@Sun.COM fi 12977836SJohn.Forte@Sun.COM 12987836SJohn.Forte@Sun.COM 12997836SJohn.Forte@Sun.COM rm_no_depend_check 13007836SJohn.Forte@Sun.COM return 0 13017836SJohn.Forte@Sun.COM} 13027836SJohn.Forte@Sun.COM 13037836SJohn.Forte@Sun.COM# 13047836SJohn.Forte@Sun.COM# check if a service has been imported into the repository 13057836SJohn.Forte@Sun.COM# $1: service to check 13067836SJohn.Forte@Sun.COM# returns 1 if it is imported, 0 if it is not 13077836SJohn.Forte@Sun.COM# 13087836SJohn.Forte@Sun.COMis_imported() 13097836SJohn.Forte@Sun.COM{ 13107836SJohn.Forte@Sun.COM $xopt 13117836SJohn.Forte@Sun.COM 13127836SJohn.Forte@Sun.COM typeset svc=$1 13137836SJohn.Forte@Sun.COM 13147836SJohn.Forte@Sun.COM svcprop -q -p general/entity_stability svc:/system/${svc} 13157836SJohn.Forte@Sun.COM if [ $? = 1 ] 13167836SJohn.Forte@Sun.COM then 13177836SJohn.Forte@Sun.COM return 0 13187836SJohn.Forte@Sun.COM else 13197836SJohn.Forte@Sun.COM return 1 13207836SJohn.Forte@Sun.COM fi 13217836SJohn.Forte@Sun.COM} 13227836SJohn.Forte@Sun.COM 13237836SJohn.Forte@Sun.COM# 13247836SJohn.Forte@Sun.COM# import the SMF services into the repository, if necessary 13257836SJohn.Forte@Sun.COM# 13267836SJohn.Forte@Sun.COMimport_services() 13277836SJohn.Forte@Sun.COM{ 13287836SJohn.Forte@Sun.COM $xopt 13297836SJohn.Forte@Sun.COM typeset svc 13307836SJohn.Forte@Sun.COM 13317836SJohn.Forte@Sun.COM for svc in $SMF_ENABLE 13327836SJohn.Forte@Sun.COM do 13337836SJohn.Forte@Sun.COM import_service $svc 13347836SJohn.Forte@Sun.COM done 13357836SJohn.Forte@Sun.COM} 13367836SJohn.Forte@Sun.COM 13377836SJohn.Forte@Sun.COM# 13387836SJohn.Forte@Sun.COM# check to see if an SMF service is in the repository. If it is not, 13397836SJohn.Forte@Sun.COM# import it in. 13407836SJohn.Forte@Sun.COM# $1: name of service to import 13417836SJohn.Forte@Sun.COM# 13427836SJohn.Forte@Sun.COMimport_service() 13437836SJohn.Forte@Sun.COM{ 13447836SJohn.Forte@Sun.COM $xopt 13457836SJohn.Forte@Sun.COM typeset svc=$1 13467836SJohn.Forte@Sun.COM 13477836SJohn.Forte@Sun.COM is_imported $svc 13487836SJohn.Forte@Sun.COM if [ $? = 0 ] 13497836SJohn.Forte@Sun.COM then 13507836SJohn.Forte@Sun.COM if [ -f $PKG_INSTALL_ROOT/$MANIFEST_PATH/$svc.xml ] 13517836SJohn.Forte@Sun.COM then 13527836SJohn.Forte@Sun.COM svccfg import $PKG_INSTALL_ROOT/$MANIFEST_PATH/$svc.xml 13537836SJohn.Forte@Sun.COM 13547836SJohn.Forte@Sun.COM if [ $OS_MINOR -lt 11 ] 13557836SJohn.Forte@Sun.COM then 13567836SJohn.Forte@Sun.COM # workaround for 6221374--let local-fs know 13577836SJohn.Forte@Sun.COM # that it depends on us. 13587836SJohn.Forte@Sun.COM svcadm refresh ${FS_LOCAL_SVC}:default 13597836SJohn.Forte@Sun.COM fi 13607836SJohn.Forte@Sun.COM fi 13617836SJohn.Forte@Sun.COM fi 13627836SJohn.Forte@Sun.COM} 13637836SJohn.Forte@Sun.COM 13647836SJohn.Forte@Sun.COM 13657836SJohn.Forte@Sun.COM########################## MAIN ###################################### 13667836SJohn.Forte@Sun.COM 13677836SJohn.Forte@Sun.COM# getopt processing 13687836SJohn.Forte@Sun.COMenable=0 13697836SJohn.Forte@Sun.COMdisable=0 13707836SJohn.Forte@Sun.COMset_location=0 13717836SJohn.Forte@Sun.COMget_info=0 13727836SJohn.Forte@Sun.COMr_flag=0 13737836SJohn.Forte@Sun.COMp_flag=0 13747836SJohn.Forte@Sun.COMwhile getopts "xedsirp" opt 2>/dev/null 13757836SJohn.Forte@Sun.COMdo 13767836SJohn.Forte@Sun.COM case $opt in 13777836SJohn.Forte@Sun.COM \?) 13787836SJohn.Forte@Sun.COM help 13797836SJohn.Forte@Sun.COM ;; 13807836SJohn.Forte@Sun.COM e) 13817836SJohn.Forte@Sun.COM enable=1 13827836SJohn.Forte@Sun.COM ;; 13837836SJohn.Forte@Sun.COM d) 13847836SJohn.Forte@Sun.COM disable=1 13857836SJohn.Forte@Sun.COM ;; 13867836SJohn.Forte@Sun.COM x) 13877836SJohn.Forte@Sun.COM xopt="set -x" 13887836SJohn.Forte@Sun.COM set -x 13897836SJohn.Forte@Sun.COM ;; 13907836SJohn.Forte@Sun.COM s) 13917836SJohn.Forte@Sun.COM set_location=1 13927836SJohn.Forte@Sun.COM ;; 13937836SJohn.Forte@Sun.COM i) 13947836SJohn.Forte@Sun.COM get_info=1 13957836SJohn.Forte@Sun.COM ;; 13967836SJohn.Forte@Sun.COM r) 13977836SJohn.Forte@Sun.COM r_flag=1 13987836SJohn.Forte@Sun.COM ;; 13997836SJohn.Forte@Sun.COM p) 14007836SJohn.Forte@Sun.COM p_flag=1 14017836SJohn.Forte@Sun.COM ;; 14027836SJohn.Forte@Sun.COM esac 14037836SJohn.Forte@Sun.COMdone 14047836SJohn.Forte@Sun.COM 14057836SJohn.Forte@Sun.COM# at most one option (besides -x) may be specified at a time 14067836SJohn.Forte@Sun.COMoptions_count=$((enable + disable + set_location + get_info)) 14077836SJohn.Forte@Sun.COMif [ $options_count -gt 1 ] 14087836SJohn.Forte@Sun.COMthen 14097836SJohn.Forte@Sun.COM help 14107836SJohn.Forte@Sun.COMelif [ $options_count = 0 ] 14117836SJohn.Forte@Sun.COMthen 14127836SJohn.Forte@Sun.COM NO_ARGS=1 14137836SJohn.Forte@Sun.COMfi 14147836SJohn.Forte@Sun.COM 14157836SJohn.Forte@Sun.COMif (( ((r_flag + p_flag) > 0) && ((enable | disable) == 0) )) 14167836SJohn.Forte@Sun.COMthen 14177836SJohn.Forte@Sun.COM echo "-r and -p options may only be used with -d or -e options" >&2 14187836SJohn.Forte@Sun.COM return 1 14197836SJohn.Forte@Sun.COMelif (( p_flag && disable )) 14207836SJohn.Forte@Sun.COMthen 14217836SJohn.Forte@Sun.COM echo "The -p option may not be used with the -d option" >&2 14227836SJohn.Forte@Sun.COM return 1 14237836SJohn.Forte@Sun.COMfi 14247836SJohn.Forte@Sun.COM 14257836SJohn.Forte@Sun.COM 14267836SJohn.Forte@Sun.COM 14277836SJohn.Forte@Sun.COM# set all the system information variables 14287836SJohn.Forte@Sun.COMget_system_state 14297836SJohn.Forte@Sun.COM 14307836SJohn.Forte@Sun.COM# if we're enabling, we need to make sure we have a valid dscfg out there. 14317836SJohn.Forte@Sun.COMif [ $enable = 1 -a $VALID_LOCAL_DB != 1 ] 14327836SJohn.Forte@Sun.COMthen 14337836SJohn.Forte@Sun.COM echo "Cannot find a valid configuration database" >&2 14347836SJohn.Forte@Sun.COM return 1 14357836SJohn.Forte@Sun.COMfi 14367836SJohn.Forte@Sun.COM 14377836SJohn.Forte@Sun.COMif [ $NO_ARGS = 1 ] 14387836SJohn.Forte@Sun.COMthen 14397836SJohn.Forte@Sun.COM 14407836SJohn.Forte@Sun.COM # only initialize the database if necessary 14417836SJohn.Forte@Sun.COM if [ $VALID_LOCAL_DB = 1 ]; then 14427836SJohn.Forte@Sun.COM echo "Local configuration database is already initialized." 14437836SJohn.Forte@Sun.COM else 14447836SJohn.Forte@Sun.COM initialize_local_db 14457836SJohn.Forte@Sun.COM if [ $? != 0 ]; then 14467836SJohn.Forte@Sun.COM return 1 14477836SJohn.Forte@Sun.COM fi 14487836SJohn.Forte@Sun.COM fi 14497836SJohn.Forte@Sun.COM 14507836SJohn.Forte@Sun.COM if [ $CLUSTER_CONFIGURED = 1 ] 14517836SJohn.Forte@Sun.COM then 14527836SJohn.Forte@Sun.COM if [ $VALID_CLUSTER_DB = 1 ]; then 14537836SJohn.Forte@Sun.COM printf "Cluster configuration database is already " 14547836SJohn.Forte@Sun.COM printf "initialized.\n" 14557836SJohn.Forte@Sun.COM else 14567836SJohn.Forte@Sun.COM # ask the user for a cluster database location 14577836SJohn.Forte@Sun.COM set_cluster_config 14587836SJohn.Forte@Sun.COM 14597836SJohn.Forte@Sun.COM # initialize the new db 14607836SJohn.Forte@Sun.COM initialize_cluster_db 14617836SJohn.Forte@Sun.COM if [ $? != 0 ]; then 14627836SJohn.Forte@Sun.COM return 1 14637836SJohn.Forte@Sun.COM fi 14647836SJohn.Forte@Sun.COM fi 14657836SJohn.Forte@Sun.COM 14667836SJohn.Forte@Sun.COM fi 14677836SJohn.Forte@Sun.COM 14687836SJohn.Forte@Sun.COM # make sure that the local filesystem dependency type is correct 14697836SJohn.Forte@Sun.COM for svc in $SMF_ENABLE 14707836SJohn.Forte@Sun.COM do 14717836SJohn.Forte@Sun.COM check_fs_local_grouping $svc 14727836SJohn.Forte@Sun.COM if [ $? -ne 0 ] 14737836SJohn.Forte@Sun.COM then 14747836SJohn.Forte@Sun.COM # NOTE: check_fs_local_grouping sets CORRECT_GROUPING 14757836SJohn.Forte@Sun.COM # To avoid this issue in the future, always administer 14767836SJohn.Forte@Sun.COM # the services using dscfgadm. 14777836SJohn.Forte@Sun.COM printf "Warning: Fixing dependency for $svc.\n" 14787836SJohn.Forte@Sun.COM set_fs_local_grouping $svc $CORRECT_GROUPING 14797836SJohn.Forte@Sun.COM if [ $? -ne 0 ] 14807836SJohn.Forte@Sun.COM then 14817836SJohn.Forte@Sun.COM return 1 14827836SJohn.Forte@Sun.COM fi 14837836SJohn.Forte@Sun.COM fi 14847836SJohn.Forte@Sun.COM done 14857836SJohn.Forte@Sun.COM 14867836SJohn.Forte@Sun.COM # give the user the chance to startup AVS services, if not started 14877836SJohn.Forte@Sun.COM check_enabled 14887836SJohn.Forte@Sun.COM if [ $? = 1 ]; then 14897836SJohn.Forte@Sun.COM if [ $OLD_VALID_LOCAL_DB = 0 ]; then 14907836SJohn.Forte@Sun.COM printf "WARNING: AVS services are running on a system " 14917836SJohn.Forte@Sun.COM printf "which had no valid configuration\ndatabase\n" 14927836SJohn.Forte@Sun.COM fi 14937836SJohn.Forte@Sun.COM show_enabled 14947836SJohn.Forte@Sun.COM else 14957836SJohn.Forte@Sun.COM ask_to_enable 14967836SJohn.Forte@Sun.COM if [ $? = 1 ]; then 14977836SJohn.Forte@Sun.COM enable_services 14987836SJohn.Forte@Sun.COM if [ $? != 0 ] 14997836SJohn.Forte@Sun.COM then 15007836SJohn.Forte@Sun.COM return 1 15017836SJohn.Forte@Sun.COM fi 15027836SJohn.Forte@Sun.COM fi 15037836SJohn.Forte@Sun.COM fi 15047836SJohn.Forte@Sun.COM 15057836SJohn.Forte@Sun.COMelif [ $enable = 1 ] 15067836SJohn.Forte@Sun.COMthen 15077836SJohn.Forte@Sun.COM enable_services 15087836SJohn.Forte@Sun.COM if [ $? != 0 ] 15097836SJohn.Forte@Sun.COM then 15107836SJohn.Forte@Sun.COM return 1 15117836SJohn.Forte@Sun.COM fi 15127836SJohn.Forte@Sun.COM 15137836SJohn.Forte@Sun.COMelif [ $disable = 1 ] 15147836SJohn.Forte@Sun.COMthen 15157836SJohn.Forte@Sun.COM disable_services 15167836SJohn.Forte@Sun.COM if [ $? != 0 ] 15177836SJohn.Forte@Sun.COM then 15187836SJohn.Forte@Sun.COM return 1 15197836SJohn.Forte@Sun.COM fi 15207836SJohn.Forte@Sun.COM 15217836SJohn.Forte@Sun.COMelif [ $get_info = 1 ] 15227836SJohn.Forte@Sun.COMthen 15237836SJohn.Forte@Sun.COM display_info 15247836SJohn.Forte@Sun.COM 15257836SJohn.Forte@Sun.COMelif [ $set_location = 1 ] 15267836SJohn.Forte@Sun.COMthen 15277836SJohn.Forte@Sun.COM if [ $CLUSTER_CONFIGURED = 1 ] 15287836SJohn.Forte@Sun.COM then 15297836SJohn.Forte@Sun.COM # ask the user for a cluster database location 15307836SJohn.Forte@Sun.COM set_cluster_config 15317836SJohn.Forte@Sun.COM 15327836SJohn.Forte@Sun.COM # initialize the new db 15337836SJohn.Forte@Sun.COM initialize_cluster_db 15347836SJohn.Forte@Sun.COM if [ $? != 0 ]; then 15357836SJohn.Forte@Sun.COM return 1 15367836SJohn.Forte@Sun.COM fi 15377836SJohn.Forte@Sun.COM else 15387836SJohn.Forte@Sun.COM echo "$PROG -s is only available on Sun Cluster OE systems" >&2 15397836SJohn.Forte@Sun.COM return 1 15407836SJohn.Forte@Sun.COM fi 15417836SJohn.Forte@Sun.COMfi 15427836SJohn.Forte@Sun.COM 15437836SJohn.Forte@Sun.COMreturn 0 15447836SJohn.Forte@Sun.COM 15457836SJohn.Forte@Sun.COM 15467836SJohn.Forte@Sun.COM########################## MAIN ###################################### 15477836SJohn.Forte@Sun.COM 1548