In SMF, service instances are identified by a Fault Management Resource Indicator. The structure of an FMRI is
<prefix>:/<class>/<service>:<instance>Example: svc:/system/cron:default
Prefixes:
- svc: SMF managed services
- lrc: legacy run command, pre Solaris 10 style services
- file: for expressing dependencies on files
Commands
- svcs: services information.
- svcs [FMRI|pattern]: list services, pattern can be a part of an FMRI and can include wildcards (example: “*nfs*”)
- -a: all - include disabled services
- -d: dependencies - show services this service depends upon
- -D: dependents - show services that depend on this service
- -xv: which services are in maintenance mode (not running) and why (v = verbose)
- -p: list associated processes
- svcs [FMRI|pattern]: list services, pattern can be a part of an FMRI and can include wildcards (example: “*nfs*”)
- svcprop <FMRI>: list service properties
- -p <[group/]property> : list only these properties
# svcprop –p start/exec cron
/lib/svc/method/svc-cron
- -p <[group/]property> : list only these properties
- svcadm: Service administration (management)
- svcadm enable <FMRI>: start (and monitor)
- -t: temporary - the service will not be restarted after reboot
- svcadm disable <FMRI>: stop
- -t: temporary - the service will still be restarted on reboot
- svcadm restart: stop, then start
- svcadm refresh: reread configuration (after svccfg)
- svcadm clear: clear maintenance mode, ask the service monitor to start a service after an error condition is resolved
- svcadm milestone FMRI: go to milestone (does not change run level)
- -d: set milestone as default target for system boots (initial default: all)
- svcadm enable <FMRI>: start (and monitor)
- svccfg: service configuration
- svccfg import <file>: import an xml service manifest in the binary service repository
- svccfg export <FMRI>: write an xml service manifest to standard output
- svccfg delete <FMRI>: remove a service definition from the binary service reporitory
- svccfg extract > site.xml: extract current services state (enabled/disabled…) to a file
- svccfg apply <file>: apply state (enabled/disabled…) of services in file
- svccfg –s <FMRI> setprop <some/property> = value: set property
- svccfg: interactive mode
# svccfg
svc:> list
system/console-login
system/device/local
…
svc:> select cron
svc:/system/cron> listprop *
usr dependency start/user astring root
…
svc:/system/cron> setprop start/user = astring: sys
svc:/system/cron> quit
- /usr/svc/bin/restore_repository: restore (corrupt) binary repository from automatic backup
Daemons
- /lib/svc/bin/svc.configd: performs the actions scheduled by configuration commands like svccfg
- /lib/svc/bin/svc.startd: monitors and restarts services
Files
- /var/svc/manifest/<class>/<service>.xml: manifest for <service> of <class>
- example: /var/svc/manifest/system/cron.xml
- stores service definition
- managed using SMF commands
- /var/svc/profile/<profile>.xml: predefined service (enabled/disabled…) configurations.
Profiles automatically applied after OS install/upgrade:- generic.xml: OS profile
- site.xml: site specific profile
- /etc/svc/repository.db: binary service repository
- /lib/svc/method: directory with start, stop, restart scripts. Manifests refer to these scripts
- example: /lib/svc/method/svc-cron
- scripts are similar to legacy /etc/init.d scripts
- /var/svc/log/<class>-<service>:<instance>.log
- per <service> <instance> log
- example: /var/svc/log/system-cron:default.log
- /etc/svc/volatile/class>-<service>:<instance>.log
- logs before the single user milestone is reached '(only root mounted)
- example: /etc/svc/volatile/system-zones:default.log
GUI
- smc
- webmin
No comments:
Post a Comment