Report an Issue | Log In | Sign Up   View a printable version of the current page.


BigAdmin

SMF Short Cuts


Added by HenryPepper , last edited by kperkins on Feb 01, 2008  (view change)
Labels: 
smf

CONTENTS of BigAdmin Wiki

BigAdmin wiki home

by Henry Pepper

Introduction

Purpose

The purpose of this topic is to enable people to create and use SMF

Writing the SMF XML files and scripts.

Scope

References

smf mgmt

scratch pad

Directories

  • /var/svc/manifest:
    • An SMF manifest is an XML file that contains a complete set of properties that are associated with a service or a service instance.
    • Manifests should not be used to modify the properties of a service. The service configuration repository is the authoritative source of configuration information.
    • To incorporate information from the manifest into the repository, you must either run svccfg import or allow the service to import the information during a system boot.
    • See also: service_bundle(4)
  • /var/svc/profile: http://docs.sun.com/app/docs/doc/819-2379/6n4m1vlbd?q=Service+Management+Facility&a=view
  • /etc/svc: This is where the repositories are stored.

Tools

inetadm

Provides the ability to observe or configure services controlled by inetd

svcadm

Change milestone svcadm milestone -d milestone/single-user:default

svccfg

Provides the ability to display and manipulate the contents of the service configuration repository

svccfg -v import /var/svc/manifest/application/MyApp.xml

svcprop

Retrieves property values from the service configuration repository with a output format appropriate for use in shell scripts.

svcs

-x explain problems
-xv explain problems and show which services are dependent
-d Show services, this service depends on.
-D Show services that depends on this service.
-p list process related to service'

boot

boot -m milestone=<milestone>", to boot to the named milestone. <milestone> can be

  • single-user
  • multi-user
  • multi-user-server
  • all : the special milestones "all" (all enabled services online)
  • none : (no services at all). The "none" milestone can be very useful in repairing systems that have failures early in the boot process.
  • boot -m verbose: for verbose boot.

Adding new services to inetd.conf

The Internet services daemon, inetd(1M), has been rewritten as part of SMF. It stores all of its configuration data in the SMF database, rather than /etc/inet/inetd.conf, allowing the SMF tools to be used to control and observe inetd-based services. Most inetd-based services that ship with Solaris will no longer have entries in inetd.conf. To provide compatibility for services which haven't converted to SMF, entries can still be added to inetd.conf using the same syntax as always, and the new inetconv(1M) command will convert the new services to SMF services. inetconv should always be run after editing /etc/inet/inetd.conf; it can be run without any arguments.

The profile XML file

General

  • **:
  • **:
  • **:

dependency

    <dependency name='multi-user'
                    grouping='require_all'
                    restart_on='error'
                    type='service'>
                        <service_fmri value='svc:/milestone/multi-user'/>
                </dependency>
  • name: Name of the dependency. ??? Can you choose this arbitrarily? Probably
    • Can't contain '.' (dot/full stop char)
  • grouping:
    • exclude_all: None of the FMRIs can be online.
    • optional_any:All FMRIs must either be online, of failed to come online. So none of the can be starting.
    • require_all: All FMRIs must be online.
    • require_any: ??? If a single FMRI in this group is online, then we are good to go.
  • restart_on: The service in this profile is restarted if the dependency encounters one of the selected situations.
    • error: restarts the service if the dependency is restarted due to a fault.
    • none: Service will be independent of dependency actions.
    • refresh: restart service if dependency 'refresh', 'restart' or encounters an error.
    • restart: restarts the service if the dependency is restarted due to a fault.
  • type:
    • service: another FMRI
    • path: File path.
      • value must start with 'file::/localhost' before the full path is written.

File

    <dependency name='my_conf_fil'
                    grouping='require_all'
                    restart_on='none'
                    type='path'>
                        <service_fmri value='file://localhost/etc/my_conf.fil'/>
                </dependency>
  • The file is: /etc/my_conf.fil
  • There is no need to set restart_on to anything but 'none' SMF currently doesn't support onaything else on files.

Service

The scripts

  • The shell script should include /lib/svc/share/smf_include.sh to get access to the return vars.
  • call smfPresent() 0 = not present, non-zero = present.

The individuals who post here are part of the extended Sun Microsystems community and they may not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact