Managing System Services in Oracle® Solaris 11.2

Exit Print View

Updated: July 2014

Stopping a Service

Use the svcadm disable command to disable an enabled or temporarily disabled service instance. A disabled instance cannot be restarted. You must first enable the instance.

How to Disable a Service Instance

  1. Check whether other services depend on this instance.
    1. List services that depend on this instance.
      $ svcs -D FMRI
    2. Check whether the dependent service requires this instance.

      For each result from the svcs -D command, use the svcs -l command to check whether the dependency is a required dependency.

      You should not disable this instance if this instance is a required dependency of another service.

  2. Disable the instance.

    The restarter for the service attempts to bring the specified instance to the disabled state.

    An instance can be permanently or temporarily disabled. Permanent disable is persistent across system reboot and is the default. Temporary disable lasts only until reboot.

    • Permanently disable the instance.
      $ svcadm disable FMRI
    • Temporarily disable the instance.

      Use the -t option to specify temporary disable.

      $ svcadm disable -t FMRI

      If you want an instance to be disabled now but run on next reboot, make sure the instance is running (in the online or degraded state), and then temporarily disable the instance. To verify that the instance is temporarily disabled, use the svcs -l command and check the enabled row:

      enabled      false (temporary)
    • Synchronously disable the instance.

      If you specify the -s option, svcadm disables the instance and waits for the instance to enter the disabled state before returning. The svcadm command returns when the instance reaches the disabled state or when it determines that the instance requires administrator intervention to reach the disabled state.

      Use the -T option with the -s option to specify an upper bound in seconds to make the transition or determine that the transition cannot be made.

      $ svcadm disable -sT 10 FMRI
  3. Verify that the instance is disabled.
    $ svcs FMRI
Example 3-3  Disabling a Service Instance

This example shows that the pkg/update:default service instance is initially online and no other services depend on this instance. The svcadm disable command is successful, the instance is currently in the disabled state, and the restart attempt fails.

$ svcs pkg/update
STATE          STIME    FMRI
online          7:18:17 svc:/application/pkg/update:default
$ svcs -D pkg/update:default
STATE          STIME    FMRI
$ svcadm disable pkg/update
$ svcs pkg/update
STATE          STIME    FMRI
disabled       22:51:12 svc:/application/pkg/update:default
$ svcadm restart pkg/update:default
$ svcs pkg/update
STATE          STIME    FMRI
disabled       22:51:12 svc:/application/pkg/update:default