A goal service defines a set of services that must be running to achieve certain functionality. The services in this critical set are specified as dependencies of the goal service.
Use one of the following methods to set the dependencies of a goal service:
Use the svcadm goals command.
Modify a profile file.
See Chapter 7, Creating a Service that Notifies if Conditions are not Satisfied in Developing System Services in Oracle Solaris 11.4 for information about recommended types of services for the dependency set of a goal service.
The svcadm goals command takes a list of services on which the goal service depends. The set of dependencies for the goal service becomes the set of services named as operands of the svcadm goals command. To add a dependency, you must list all current dependencies as well as the new dependency.
Services specified as operands of the svcadm goals command are administrative customizations of the goal service, or admin layer changes. See Repository Layers for information about layers. The svcadm goals command resets all administrative customizations on the dependency set of the goal service.
Dependencies set by using the svcadm goals command are in the require_all dependency grouping, and the value of the restart_on attribute is restart. See Dependency Groupings and Showing Whether a Service Will Automatically Restart for more information. If you want a dependency of a goal service to have a different grouping or different restart_on setting, use the svccfg command to change the attributes of that dependency. For example, if you must include a dynamically-enabled service as a dependency of a goal service, use the svccfg command to change the value of the grouping attribute of the dependency to optional_all.
Example 19 Resetting the Dependency Set for a Goal ServiceThe following command replaces the dependency set for the milestone/goals goal service with the specified database/oracle, database/listener, and milestone/multi-user-server services. The milestone/multi-user-server service is the default goal specified at the manifest layer. If you do not include multi-user-server in the svcadm goals command, then multi-user-server will be masked and not used as a goal. The svcadm goals command replaces all currently set goals. By default, the svcadm goals command operates on the milestone/goals service. To replace the dependency set for a goal service that is not the milestone/goals service, use the -g option to specify the goal service.
$ svcadm goals site/application/database/oracle:default \ > site/application/database/listener:default \ > svc:/milestone/multi-user-server:default
Both of the following commands show that the milestone/goals service now has three goal dependencies:
$ svcprop -p goals-dependencies/entities milestone/goals $ svcs -d milestone/goals
Both of the following commands show that resetting the dependency set of a goal service is an administrative customization. See Showing Configuration Customizations for more information about customizations.
$ svccfg -s milestone/goals listcust $ svccfg -s milestone/goals listprop -l all goals-dependencies/entitiesExample 20 Removing Dependencies From a Goal Service
The -c option clears administrative customizations of the dependency set. The set of dependencies for the goal service reverts to the set of dependencies delivered at the manifest and profile layers. See Repository Layers for information about layer content and hierarchy.
The following command removes all dependencies except the default milestone/multi-user-server dependency from the milestone/goals service. Use the -g option to clear all admin layer dependencies for a goal service that is not the milestone/goals service.
$ svcadm goals -c
Both of the following commands show that only goal dependencies set at the manifest layer or a profile layer remain:
$ svcprop -p goals-dependencies/entities -l all milestone/goals $ svccfg -s milestone/goals listprop -l all goals-dependencies/entities
The svccfg delcust command can remove all admin layer customizations for a service instance. To remove only the dependencies customizations for a goal service instance, use the -c option of the svcadm goals command, See Example 40, Deleting Customizations for more information about the delcust subcommand.
To set goals as file-backed configuration, also called configuration with bundle support, create an SMF profile as described in Configuring Multiple Systems. File-backed configuration cannot be removed by using the svcadm goals -c command.
For an existing goal service, the easiest way to create a profile is to use the svccfg extract command as described in How to Create a Profile by Using svccfg. Modify the goals-dependencies section.
The following command shows customizations made in profile layers as well as any customizations made in the admin layer:
$ svccfg -s milestone/goals listcust -L goals-dependencies