Home | History | Annotate | Download | only in saa
      1 #!/usr/bin/ksh 
      2 #
      3 # CDDL HEADER START
      4 #
      5 # The contents of this file are subject to the terms of the
      6 # Common Development and Distribution License (the License).
      7 # You may not use this file except in compliance with the License.
      8 #
      9 # You can obtain a copy of the license at usr/src/CDDL.txt
     10 # or http://www.opensolaris.org/os/licensing.
     11 # See the License for the specific language governing permissions
     12 # and limitations under the License.
     13 #
     14 # When distributing Covered Code, include this CDDL HEADER in each
     15 # file and include the License file at usr/src/CDDL.txt.
     16 # If applicable, add the following below this CDDL HEADER, with the
     17 # fields enclosed by brackets [] replaced with your own identifying
     18 # information: Portions Copyright [yyyy] [name of copyright owner]
     19 #
     20 # CDDL HEADER END
     21 #
     22 
     23 #
     24 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     25 # Use is subject to license terms.
     26 #
     27 #ident	"@(#)start_SAA.ksh	1.8	08/07/21 SMI"
     28 
     29 PERFORM_REAL_MONITORING=0
     30 
     31 typeset opt
     32 
     33 while getopts 'R:G:P' opt
     34 do
     35         case "$opt" in
     36                 R)      RESOURCE=$OPTARG;;
     37                 G)      RESOURCEGROUP=$OPTARG;;
     38 		P)	PERFORM_REAL_MONITORING=1;;
     39                 *)      exit 1;;
     40         esac
     41 done
     42 
     43 . `dirname $0`/../etc/config
     44 . `dirname $0`/functions
     45 
     46 validate_options
     47 
     48 debug_message "Method: `basename $0` - Begin"
     49 $SET_DEBUG
     50 
     51 rm $LOGFILE 2>/dev/null
     52 
     53 validate
     54 
     55 if [ "$rc_validate" -ne 0 ]
     56 then
     57         debug_message "Method: `basename $0` - End (Exit 1)"
     58         exit 1
     59 fi
     60 
     61 # make sure there is a pid left for pmf until start_SAA does finish
     62 START_TIMEOUT=`${SCHA_RESOURCE_GET} -O START_TIMEOUT -R ${RESOURCE} -G ${RESOURCEGROUP}`
     63 sleep ${START_TIMEOUT} &
     64 
     65 # disable pmf tag
     66 if ${PMFADM} -q ${RESOURCEGROUP},${RESOURCE},0.svc
     67 then
     68 	${PMFADM} -s ${RESOURCEGROUP},${RESOURCE},0.svc
     69 fi
     70 
     71 get_SAA_version
     72 
     73 if [ "${saa_version}" = "6.2" ]; then
     74 	start_DB_SAA
     75 else
     76 	if [ -z "$use_dce" ]; then
     77 		log_message err "Error: use_dce not set - problem in agent"
     78 		exit 1
     79 	fi
     80 
     81 	if [ "$use_dce" -eq 1 ];then
     82 		debug_message "using dce rpc for version < 5.9"
     83 		start_dce
     84 
     85 		if [ "$rc_start_dce" -ne 0 ]; then
     86 			log_message err "start_dce rc<$rc_start_dce>"
     87 			debug_message "Method: `basename $0` - End (Exit $rc_start_dce)"
     88 			exit $rc_start_dce
     89 		fi
     90 
     91 		# first step in starting is stopping swa_rpcd if not alredy stopped
     92 		stop_swa_rpcd
     93 	
     94 		if [ "$rc_stop_swa_rpcd" -ne 0 ]; then
     95 			log_message err "could not kill swa_rpcd"
     96 			debug_message "Method: `basename $0` - End (Exit 1)"
     97 			exit 1
     98 		fi	
     99 
    100 		check_hostrename
    101 		if [ "$rc_check_hostrename" -ne 0 ]; then
    102 			log_message err "error in configuration of SAA"
    103 			debug_message "Method: `basename $0` - End (Exit 1)"
    104 			exit 1
    105 		fi
    106 
    107 		start_swa_rpcd
    108 		if [ "$rc_start_swa_rpcd" -ne 0 ]; then
    109 			log_message err "could not start swa_rpcd, aborting"
    110 			debug_message "Method: `basename $0` - End (Exit 1)"
    111 			exit 1
    112 		fi
    113 	else
    114 		stop_swa_boot
    115 		if [ "$rc_stop_swa_boot" -ne 0 ]; then
    116 			log_message err "could not kill swa_boot"
    117 			debug_message "Method: `basename $0` - End (Exit 1)"
    118 			exit 1
    119 		fi
    120 
    121 		if [ -x /usr/swa/apply_alliance_ports ]; then
    122 			/usr/swa/apply_alliance_ports >> ${LOGFILE} 2>&1
    123 		fi
    124 
    125 		check_hostrename
    126 		if [ "$rc_check_hostrename" -ne 0 ]; then
    127 			log_message err "error in configuration of SAA"
    128 			debug_message "Method: `basename $0` - End (Exit 1)"
    129 			exit 1
    130 		fi
    131 
    132 		start_swa_boot
    133 		if [ "$rc_start_swa_boot" -ne 0 ]
    134 		then
    135 			log_message err "swa_boot returned: $rc_start_swa_boot"
    136 			debug_message "Method: `basename $0` - End (Exit 1)"
    137 			exit 1
    138 		fi
    139 	fi
    140 
    141 	start_SAA
    142 fi
    143 
    144 if [ "$rc_start_command" -eq 0 ]
    145 then
    146         log_message notice "SAA start result code : $rc_start_command"
    147 
    148         debug_message "Method: `basename $0` - End (Exit 0)"
    149         exit 0
    150 else
    151         log_message err "start_command rc<$rc_start_command>"
    152 	debug_message "Method: `basename $0` - End (Exit $rc_start_command)"
    153 	exit $rc_start_command
    154 fi
    155