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