Solaris 10 provide some new (interesting) tools to manage services.

Services managements

Start/Stop/Reload a service

# svcadm enable network/ssh
# svcadm disable network/ssh
# svcadm refresh network/ssh

Check status

# svcs -x network/ssh
svc:/network/ssh:default (SSH server)
 State: online since Sat Mar 19 12:49:43 2005
   See: sshd(1M)
   See: /var/svc/log/network-ssh:default.log
Impact: None.

Check dependencies

# svcs -l network/ssh
fmri         svc:/network/ssh:default
name         SSH server
enabled      true
state        online
next_state   none
state_time   Wed May 04 16:36:29 2005
logfile      /var/svc/log/network-ssh:default.log
restarter    svc:/system/svc/restarter:default
contract_id  44 
dependency   require_all/none svc:/system/filesystem/local (online)
dependency   optional_all/none svc:/system/filesystem/autofs (online)
dependency   require_all/none svc:/network/loopback (online)
dependency   require_all/none svc:/network/physical (online)
dependency   require_all/none svc:/system/cryptosvc (online)
dependency   require_all/none svc:/system/utmp (online)
dependency   require_all/restart file://localhost/etc/ssh/sshd_config (online)

Learning more about SMF

Others links

A simple example

Note: this is my first one. It is very simple. I need to work on it, especially for the name of instance (sunoneds here).

sunone-ds.xml

<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='ldapserver'>
<service
        name='network/ldap/server'
        type='service'
        version='1'>
 
        <create_default_instance enabled='false' />
        <single_instance />
 
        <dependency name='net' grouping='require_all' restart_on='none' type='service'>
          <service_fmri value='svc:/network/initial'/>
        </dependency>
 
        <dependent name='ldap-server_multi-user-server' restart_on='none' grouping='optional_all'>
           <service_fmri value='svc:/milestone/multi-user-server'/>
        </dependent>
 
        <exec_method
                type='method'
                name='start'
                exec='/var/Sun/mps/slapd-sunoneds/start-slapd'
                timeout_seconds='120' >
                        <method_context>
                                <method_credential user='root' group='root' privileges='basic'/>
                        </method_context>
        </exec_method>
 
        <exec_method type='method' name='stop'
             exec='/var/Sun/mps/slapd-sunoneds/stop-slapd'
         timeout_seconds='30' />
 
</service>
</service_bundle>

Import service definitions

# svccfg
svc:> import /var/svc/manifest/system/zones.xml
# svcfg import sunone-ds.xml

Logs

Services's logs are store in /var/svc/logs/<service name>