Home | History | Annotate | Download | only in lsr
      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 #ident   "@(#)lsr_smf_register.ksh 1.4     07/08/07 SMI"
     28 #
     29 # 	DO NOT EDIT THIS FILE
     30 #
     31 
     32 create_xml()
     33 {
     34 	COMPONENT=lsr
     35 	MYDIR=/opt/SUNWscmqs
     36 	MANIFEST_DIR=/var/svc/manifest/application/sczone-agents
     37 
     38 	[ ! -d "${MANIFEST_DIR}" ] && mkdir -p ${MANIFEST_DIR}
     39 
     40 	cat > ${MANIFEST_DIR}/${RS}.xml <<-EOF
     41 	<?xml version="1.0"?>
     42 	<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
     43 
     44 	<!--
     45 	    Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
     46 	    Use is subject to license terms.
     47 	-->
     48 
     49 	<service_bundle type='manifest' name='${RS}'>
     50 
     51 	<service
     52 	name='application/sczone-agents'
     53 	type='service'
     54 	version='1'>
     55 
     56 	<instance name='${RS}' enabled='false'>
     57 
     58 	<!--
     59 	    Dependencies
     60 	-->
     61 
     62 	<dependency name='${COMPONENT}_services'
     63 	grouping='require_all'
     64 	restart_on='none'
     65 	type='service'>
     66 		<service_fmri value='svc:/milestone/multi-user-server'/>
     67 		<service_fmri value='svc:/network/loopback'/>
     68 		<service_fmri value='svc:/network/physical'/>
     69 	</dependency>
     70 
     71 	<dependency name='${COMPONENT}_paths'
     72 	grouping='require_all'
     73 	restart_on='none'
     74 	type='path'>
     75 		<service_fmri value='file:///var/mqm'/>
     76 		<service_fmri value='file:///opt/mqm'/>
     77 	</dependency>
     78 	
     79 	<exec_method
     80 	type='method'
     81 	name='start'
     82 	exec='${MYDIR}/bin/control_wmqs start ${COMPONENT} ${RS}'
     83 	timeout_seconds='300' >
     84 		<method_context project='${PROJECT}' >
     85 		<method_credential user='${USERID}' />
     86 	</method_context>
     87 	</exec_method>
     88 
     89 	<exec_method
     90 	type='method'
     91 	name='stop'
     92 	exec='${MYDIR}/bin/control_wmqs stop ${COMPONENT} ${RS}'
     93 	timeout_seconds='300' >
     94 		<method_context project='${PROJECT}'>
     95 		<method_credential user='${USERID}' />
     96 	</method_context>
     97 	</exec_method>
     98 
     99 	<property_group name='parameters' type='general'>
    100 		<propval name='RESOURCE' type='astring' value='${RS}'/>
    101 		<propval name='RESOURCEGROUP' type='astring' value='${RG}'/>
    102 		<propval name='QMGR' type='astring' value='${QMGR}'/>
    103 		<propval name='PORT' type='astring' value='${PORT}'/>
    104 		<propval name='IPADDR' type='astring' value='${IPADDR}'/>
    105 		<propval name='BACKLOG' type='astring' value='${BACKLOG}'/>
    106 	</property_group>
    107 
    108 	<property_group name='startd' type='framework'>
    109 		<propval name='duration' type='astring' value='transient' />
    110 		<propval name='ignore_error' type='astring' value='core'/>
    111 	</property_group>
    112 
    113 	</instance>
    114 
    115 	<stability value='Evolving' />
    116 
    117 	<template>
    118 	<common_name>
    119 	<loctext xml:lang='C'>
    120 	WebSphere MQ
    121 	</loctext>
    122 	</common_name>
    123 	</template>
    124 	</service>
    125 
    126 	</service_bundle>
    127 
    128 	EOF
    129 }
    130 
    131 # $1 is passed from lsr_register as ${TMP_WORK_CONFIG}
    132 . $1
    133 
    134 create_xml 
    135 
    136 /usr/bin/printf "${MANIFEST_DIR}/${RS}.xml successfully created\n"
    137 
    138 if /usr/sbin/svccfg validate ${MANIFEST_DIR}/${RS}.xml; then
    139    /usr/bin/printf "${MANIFEST_DIR}/${RS}.xml successfully validated\n"
    140 else
    141    /usr/bin/printf "${MANIFEST_DIR}/${RS}.xml validation failed\n"
    142    exit 1
    143 fi
    144 
    145 if /usr/sbin/svccfg import ${MANIFEST_DIR}/${RS}.xml; then
    146    /usr/bin/printf "${MANIFEST_DIR}/${RS}.xml successfully imported\n"
    147 else
    148    /usr/bin/printf "${MANIFEST_DIR}/${RS}.xml import failed\n"
    149    exit 1
    150 fi
    151 
    152