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	"@(#)stop_SAA.ksh	1.8	08/07/21 SMI"
     28 #
     29 
     30 PERFORM_REAL_MONITORING=0
     31 
     32 typeset opt
     33 
     34 while getopts 'R:G:P' opt
     35 do
     36         case "$opt" in
     37                 R)      RESOURCE=$OPTARG;;
     38                 G)      RESOURCEGROUP=$OPTARG;;
     39 		P)	PERFORM_REAL_MONITORING=1;;
     40                 *)      exit 1;;
     41         esac
     42 done
     43 
     44 . `dirname $0`/../etc/config
     45 . `dirname $0`/functions
     46 
     47 validate_options
     48 
     49 debug_message "Method: `basename $0` - Begin"
     50 $SET_DEBUG
     51 
     52 get_SAA_version
     53 
     54 if [ "${saa_version}" = "6.2" ]; then
     55 	stop_DB_SAA
     56 else
     57 	stop_SAA
     58 
     59 	if [ -z "$use_dce" ];then
     60 		log_message err "use_dce var is empty , error in agent"
     61 		exit 1
     62 	fi
     63 
     64 	if [ "$use_dce" -eq 1 ]; then
     65 
     66 		stop_dce
     67 		if [ "$rc_stop_dce" -eq 0 ]
     68 		then
     69 			log_message notice "stopped dce rc<$rc_stop_dce>"
     70 		else
     71 			rc_stop_command=1
     72 			log_message err "stop dced failed rc<$rc_stop_dce>"
     73 		fi
     74 
     75 		stop_swa_rpcd
     76 		if [ "$rc_stop_swa_rpcd" -ne 0 ]
     77 		then
     78 			log_message err "could not kill swa_rpcd"
     79 		fi
     80 	else
     81 		stop_swa_boot
     82 		if [ "$rc_stop_swa_boot" -ne 0 ]
     83 		then
     84 			log_message err "could not kill swa_boot"
     85 		fi
     86 	fi
     87 fi
     88 
     89 # make sure the dummy sleep started in start_SAA did already
     90 # finish, otherwise kill it.
     91 if ${PMFADM} -q ${RESOURCEGROUP},${RESOURCE},0.svc
     92 then
     93 	${PMFADM} -s ${RESOURCEGROUP},${RESOURCE},0.svc KILL 2> /dev/null
     94 fi
     95 
     96 if [ "$rc_stop_command" -eq 0 ]
     97 then
     98         log_message notice "stopped SAA rc<$rc_stop_command>"
     99 	debug_message "Method: `basename $0` - End (Exit 0)"
    100 	exit 0
    101 else
    102         log_message err "stop SAA failed rc<$rc_stop_command>"
    103 	debug_message "Method: `basename $0` - End (Exit 1)"
    104 	exit 1
    105 fi
    106