Es posible que el manifiesto de servicio generado con el comando svcbundle cumpla sus requisitos sin necesidad de realizar modificaciones. En el siguiente ejemplo, se muestra una modificación del manifiesto de servicio.
Si modifica un manifiesto de servicio, utilice el comando svccfg validate para garantizar que el manifiesto siga siendo válido.
Ejemplo 13-4 Manifiesto de servicio personalizado: aumento del tiempo permitido para la ejecución de la secuencia de comandosEn la siguiente copia del manifiesto de servicio generado, el timeout predeterminado de exec_method de 60 segundos se aumentó para el método start. Asegúrese de que el método start dispone de tiempo suficiente para ejecutar la secuencia de comandos del primer inicio.
<?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> <!-- Make sure the start method has adequate time to run the script. --> <exec_method timeout_seconds="360" 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>
$ svccfg validate first-boot-script-svc-manifest.xmlEjemplo 13-5 Manifiesto de servicio personalizado: cómo asegurarse de que la secuencia de comandos se ejecute después de la instalación de zonas no globales
En el siguiente fragmento de manifiesto de servicio, se cambia la dependencia de svc:/milestone/multi-user por la dependencia de svc:/system/zones-install para asegurarse de que la secuencia de comandos del primer inicio se ejecute una vez que estén instaladas todas las zonas no globales.
<!-- The following dependency keeps us from starting until all non-global zones are installed. --> <dependency restart_on="none" type="service" name="ngz_dependency" grouping="require_all"> <service_fmri value="svc:/system/zones-install"/> </dependency>