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