Forum Stats

  • 3,874,799 Users
  • 2,266,773 Discussions


Solaris 11.3 SMF: How to disable a custom service if the start/exec failed

1419051 Member Posts: 1
edited Jun 28, 2019 1:57PM in SPARC Servers

Hi, In Solaris 11.3, I would like to leave my custom service in disabled (temp) mode if its start exec script failed. Right now it just keeps on restarting it with the same failure. Thanks.


  • Jens
    Jens Member Posts: 91 Blue Ribbon
    edited Jun 28, 2019 1:57PM

    Seems to be better of in 'Solaris 11' but anyhow as I am typing :-)

    Disclaimer: I am by no means competent to give advice on this topic but can probably provide a few bread crumbs that I'd follow, if using a bottom up aproach. Have a look at the oracle documentation for Solaris for top down. Typically it is really worthwhile to take a rest and have a read there.

    First, I'd like to suggest to rethink whether you actually want to temporary disable the service or send it to maintenance mode (-> Admin interaction required, system state 'degraded', perhaps some notification sent), based on the type of service and issues that prevent successful start and the consequences this has (e.g. dependencies).

    You'll find some examples of scripts in /lib/svc/methods that actually influence the state.

    See e.g nfs-server which, depending on the type of issue, either marks the service as needing maintenance or

    signals the restarter to mark the state as temporarily disabled via its error level/return value.

    /usr/sbin/svcadm mark -t maintenance svc:/network/nfs/server

    smf_method_exit $SMF_EXIT_TEMP_DISABLE no_shares \

                            "No NFS filesystems are shared"

    I'd assume the svcadm mark in nfs-server to be a slight overkill as  SMF_EXIT_ERR_FATAL  is used afterwards, but this of would assume the restarter to actually mark the service.

    See e.g. man smf_method and man smf for details.

    Hope this helps a bit, matches your setting and does not mislead you.

    Best regards