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.
$ svcs -D FMRI
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. See Showing Service Dependencies for information about dependency groupings and restart_on values.
The restarter for the service attempts to bring the specified instance to the disabled state. In general, the restarter for the service attempts to run the stop method if a stop method exists. The periodic restarter does not attempt to run any stop method because processes contracted by a periodic instance do not run persistently. Periodic instances run short-lived processes and then wait until the next scheduled time to run. See Chapter 3, Creating a Service to Run Periodically in Developing System Services in Oracle Solaris 11.4 for more information.
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.
$ svcadm disable FMRI
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)
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
$ svcs FMRI
The following commands show that the Generic Security Service, rpc/gss, is online, and services that depend on the rpc/gss service are disabled:
$ svcs rpc/gss STATE STIME FMRI online Oct_20 svc:/network/rpc/gss:default $ svcs -D rpc/gss STATE STIME FMRI disabled Oct_20 svc:/network/nfs/client:default disabled Oct_20 svc:/network/smb/client:default disabled Oct_21 svc:/network/nfs/server:default
The following command shows that even if the dependents were online, the rpc/gss service is an optional dependency and no attempt will be made to start the rpc/gss service if any of these three dependent services is refreshed or stopped for any reason:
$ svcs -l nfs/client smb/client nfs/server | grep rpc/gss dependency optional_all/none svc:/network/rpc/gss (online) dependency optional_all/none svc:/network/rpc/gss (online) dependency optional_all/none svc:/network/rpc/gss (online)
The svcadm disable command is successful, the instance is currently in the disabled state, and the restart attempt fails.
$ svcadm disable rpc/gss $ svcs rpc/gss STATE STIME FMRI disabled 12:45:55 svc:/network/rpc/gss:default $ svcadm restart pkg/update:default $ svcs rpc/gss STATE STIME FMRI disabled 12:45:55 svc:/network/rpc/gss:default