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