Home | History | Annotate | Download | only in mys
      1 #!/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 2007 Sun Microsystems, Inc.  All rights reserved.
     25 # Use is subject to license terms.
     26 #
     27 
     28 #ident	"@(#)ha_mysql_smf_remove.ksh	1.8	07/06/06 SMI"
     29 
     30 #
     31 #  This script to remove an smf service and its manifast takes 
     32 #  the optional -f option
     33 #
     34 #  -f filename states a config file different from xxx_config.
     35 #     This file will be sourced instead of xxx_config if -f filename is specified
     36 
     37 
     38 MYCONFIG=
     39 MANIFEST_DIR=/var/svc/manifest/application/sczone-agents
     40 
     41 typeset opt
     42 
     43 while getopts 'f:' opt
     44 do
     45         case "${opt}" in
     46                 f)      MYCONFIG=${OPTARG};;
     47                 *)      exit 1;;
     48         esac
     49 done
     50 
     51 # Sourcing the specified config file, either the default one,
     52 # or the one supplied with -f
     53 
     54 if [ -n "${MYCONFIG}" ] && [ -f "${MYCONFIG}" ]
     55 then
     56 	echo "sourcing ${MYCONFIG}"
     57 	. ${MYCONFIG}
     58 else
     59 	PKGCONF=`dirname $0`/ha_mysql_config
     60 	echo "sourcing ${PKGCONF}"
     61 	. ${PKGCONF}
     62 fi
     63 
     64 # Removing the smf service and its manifest
     65 
     66 SERVICE_TAG=svc:/application/sczone-agents:${RS}
     67 
     68 echo "disabling the smf service ${SERVICE_TAG}"
     69 /usr/sbin/zlogin ${ZONE} svcadm disable ${SERVICE_TAG}
     70 
     71 echo "removing the smf service ${SERVICE_TAG}"
     72 /usr/sbin/zlogin ${ZONE} svccfg delete ${SERVICE_TAG}
     73 
     74 echo "removing the smf manifest ${MANIFEST_DIR}/${RS}.xml"
     75 /usr/sbin/zlogin ${ZONE} rm ${MANIFEST_DIR}/${RS}.xml
     76 
     77 exit 0
     78