Puede utilizar el comando svcbundle para generar un manifiesto de servicio válido. En el siguiente ejemplo, observe que, de manera predeterminada, un manifiesto generado por el comando svcbundle especifica un servicio temporal y la dependencia multi-user.
Ejemplo 13-3 Manifiesto generado del servicio SMFEn el comando siguiente, el nombre de la secuencia de comandos que se muestra en Creación de una secuencia de comandos que se ejecute en el primer inicio se especifica como valor de start-method. El nombre de la secuencia de comandos se especifica como /opt/site/first-boot-script.sh porque el paquete creado en Creación de un paquete IPS para la secuencia de comandos y el servicio instala la secuencia de comandos first-boot-script.sh en /opt/site/first-boot-script.sh.
En el comando siguiente, la propiedad completed se especifica mediante una lista separada por dos puntos de nombre de grupo de propiedades, nombre de propiedad, tipo de propiedad y valor de propiedad inicial.
$ svcbundle -s service-name=site/first-boot-script-svc \ -s start-method=/opt/site/first-boot-script.sh \ -s instance-property=config:completed:boolean:false \ > first-boot-script-svc-manifest.xml
En el manifiesto de servicio generado que se muestra a continuación, la secuencia de comandos del primer inicio, /opt/site/first-boot-script.sh, representa el valor del atributo exec del método start. La propiedad completed se especifica en el elemento instance que define la instancia predeterminada de este servicio, first-boot-script-svc:default.
<?xml version="1.0" ?> <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'> <!-- Manifest created by svcbundle (2014-Jan-14 16:39:30-0700) --> <service_bundle type="manifest" name="site/first-boot-script-svc"> <service version="1" type="service" name="site/first-boot-script-svc"> <!-- The following dependency keeps us from starting until the multi-user milestone is reached. --> <dependency restart_on="none" type="service" name="multi_user_dependency" grouping="require_all"> <service_fmri value="svc:/milestone/multi-user"/> </dependency> <exec_method timeout_seconds="60" type="method" name="start" exec="/opt/site/first-boot-script.sh"/> <!-- The exec attribute below can be changed to a command that SMF should execute to stop the service. See smf_method(5) for more details. --> <exec_method timeout_seconds="60" type="method" name="stop" exec=":true"/> <!-- The exec attribute below can be changed to a command that SMF should execute when the service is refreshed. Services are typically refreshed when their properties are changed in the SMF repository. See smf_method(5) for more details. It is common to retain the value of :true which means that SMF will take no action when the service is refreshed. Alternatively, you may wish to provide a method to reread the SMF repository and act on any configuration changes. --> <exec_method timeout_seconds="60" type="method" name="refresh" exec=":true"/> <property_group type="framework" name="startd"> <propval type="astring" name="duration" value="transient"/> </property_group> <instance enabled="true" name="default"> <property_group type="application" name="config"> <propval type="boolean" name="completed" value="false"/> </property_group> </instance> <template> <common_name> <loctext xml:lang="C"> <!-- Replace this comment with a short name for the service. --> </loctext> </common_name> <description> <loctext xml:lang="C"> <!-- Replace this comment with a brief description of the service --> </loctext> </description> </template> </service> </service_bundle>