Home | History | Annotate | Download | only in trm
      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   "@(#)trm_smf_register.ksh 1.5     07/08/07 SMI"
     28 #
     29 # 	DO NOT EDIT THIS FILE
     30 #
     31 
     32 create_xml()
     33 {
     34 	COMPONENT=trm
     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='TRIGGER_MONITOR' type='astring' value='${TRMQ}'/>
    104 	</property_group>
    105 
    106 	<property_group name='startd' type='framework'>
    107 		<propval name='duration' type='astring' value='transient' />
    108 		<propval name='ignore_error' type='astring' value='core'/>
    109 	</property_group>
    110 
    111 	</instance>
    112 
    113 	<stability value='Evolving' />
    114 
    115 	<template>
    116 	<common_name>
    117 	<loctext xml:lang='C'>
    118 	WebSphere MQ
    119 	</loctext>
    120 	</common_name>
    121 	</template>
    122 	</service>
    123 
    124 	</service_bundle>
    125 
    126 	EOF
    127 }
    128 
    129 # $1 is passed from trm_register as ${TMP_WORK_CONFIG}
    130 . $1
    131 
    132 create_xml 
    133 
    134 /usr/bin/printf "${MANIFEST_DIR}/${RS}.xml successfully created\n"
    135 
    136 if /usr/sbin/svccfg validate ${MANIFEST_DIR}/${RS}.xml; then
    137    /usr/bin/printf "${MANIFEST_DIR}/${RS}.xml successfully validated\n"
    138 else
    139    /usr/bin/printf "${MANIFEST_DIR}/${RS}.xml validation failed\n"
    140    exit 1
    141 fi
    142 
    143 if /usr/sbin/svccfg import ${MANIFEST_DIR}/${RS}.xml; then
    144    /usr/bin/printf "${MANIFEST_DIR}/${RS}.xml successfully imported\n"
    145 else
    146    /usr/bin/printf "${MANIFEST_DIR}/${RS}.xml import failed\n"
    147    exit 1
    148 fi
    149 
    150