SMF

From pressy's brainbackup
Jump to: navigation, search

service management facility

SMF manifest

I've done this for a SAP costumer, optional apache installation:

# mkdir /var/svc/manifest/application/sap
# cd /var/svc/manifest/application/
# vi sapapache.xml


###################################################
<?xml version="1.0"?> <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='sapapache'>
<service name='application/sap/sapapache' type='service' version='1'>
      <create_default_instance enabled="true"/> <single_instance />
      <dependency
            name='filesystem' grouping='require_all' restart_on='none'
            type='service'> <service_fmri value='svc:/system/filesystem/local' />
      </dependency>

      <exec_method
       type='method' name='start' exec='/usr/local/apache2/bin/apachectl start'
            timeout_seconds='120' />
      <exec_method
       type='method' name='stop' exec='/usr/local/apache2/bin/apachectl stop'
            timeout_seconds='120' />
      <exec_method
       type='method' name='restart' exec='/usr/local/apache2/bin/apachectl restart'
            timeout_seconds='120' />
      <stability value='Unstable' />
      <template>
            <common_name>
                  <loctext xml:lang='C'>SAP Apache2 64bit</loctext>
            </common_name> <documentation>
                  <manpage title='httpd' section='8'/>
            </documentation>
      </template>
</service> </service_bundle>
###################### EOF ######################

Validate

Verify the validity of the xml file (command should run with no errors)

# svccfg -v validate sapapache.xml 

If you get a cryptic parse error you can try running the following to track it down

# xmllint --valid sapapache.xml 

No error, now we can import it

# svccfg -v import sapapache.xml 

Go Go Go

# svcs -v sapapache 
# svcadm enable sapapach