Go to main content

Managing System Services in Oracle® Solaris 11.4

Exit Print View

Updated: Febuary 2019
 
 

Deleting a Service

The svccfg delete command does not remove a service instance from the system. Instead, the svccfg delete command masks the instance. After you run the svccfg delete command, the service manifest still exists in /lib/svc/manifest. SMF keeps the service configuration repository in sync with file system content. Since the manifest still exists on the file system in a standard location, that service information is still stored in the repository and is only masked from normal view. Any administrative customizations are deleted from a masked instance. See the smf(7) man page for a description of masked entities.

Files that support a service instance are updated when you use pkg commands, even if that service instance is masked. When files that support a service instance are updated by pkg commands, the SMF data store is updated even though the service is still masked from view. If the service instance is unmasked, that service instance is already updated from the files delivered by pkg with no further intervention needed. To unmask a service instance, see How to Undo Deletion of a Service Instance.

How to Delete a Service Instance

  1. Check the dependents of the instance to be deleted.

    Use the svcs -D command to show instances that depend on this instance. After you delete this instance, dependent instances might not be able to run. Use the svcs -l command to check whether this instance is a required dependency of the dependent instance.

  2. Mask the instance.

    Use the svccfg delete command to mask the instance from normal view. Use the svcs command to show the state of the instance. If the instance is running (is in the online or degraded state), use the svccfg delete -f command to mask the instance from normal view.

    $ svcs -H my-svc
    disabled        7:25:37 svc:/site/my-svc:default
    $ svccfg delete svc:/site/my-svc:default
  3. Verify that the instance is masked.

    Use the svccfg listcust -M command to confirm that the instance is masked. Commands such as svcs should display an error message that no matching instance is found.

    $ svccfg listcust -M
    svc:/site/my-svc:default manifest MASKED
      general                      admin    MASKED
      general/complete astring     admin    MASKED
      general/enabled  boolean     admin    MASKED true
    $ svcs -H my-svc
    svcs: Pattern 'my-svc' doesn't match any instances

How to Undo Deletion of a Service Instance

  1. Confirm that the instance is masked.

    Use the svccfg listcust -M command as shown in the previous procedure.

  2. Unmask the instance.
    $ svccfg -s svc:/site/my-svc:default delcust
     Deleting customizations for instance: default

    Reimporting the manifest does not remove a mask.

  3. Verify that the instance is unmasked.

    Use the svccfg listcust -M command to confirm that the instance is not masked. The svcs command should display the state of the instance.