JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Managing Services and Faults in Oracle Solaris 11.1     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

1.  Managing Services (Overview)

2.  Managing Services (Tasks)

Monitoring SMF Services

Monitoring Services (Task Map)

How to List the Status of a Service

How to List Customizations of a Service

How to Show Which Services Are Dependent on a Service Instance

How to Show Which Services a Service Is Dependent On

How to Set Up Notification of SMF Transition Events

Managing SMF Services

Managing SMF Services (Task Map)

Using RBAC Rights Profiles With SMF

How to Create an SMF Service

How to Disable a Service Instance

How to Enable a Service Instance

How to Restart a Service

How to Restore a Service That Is in the Maintenance State

How to Create an SMF Profile

How to Manually Create an SMF Profile

How to Apply an SMF Profile

Configuring SMF Services

Configuring SMF Services (Task Map)

How to Modify an SMF Service Property

How to Modify Multiple Properties for One Service

How to Modify a Service That Is Configured by a File

How to Change an Environment Variable for a Service

How to Change a Property for an inetd Controlled Service

How to Delete Customizations for a Service

How to Modify a Command-Line Argument for an inetd Controlled Service

How to Convert inetd.conf Entries

Using Run Control Scripts

Using Run Control Scripts (Task Map)

How to Use a Run Control Script to Stop or Start a Legacy Service

How to Add a Run Control Script

How to Disable a Run Control Script

How to Convert a Run Control Script to an SMF Service

Troubleshooting the Service Management Facility

Troubleshooting SMF (Task Map)

How to Debug a Service That Is Not Starting

How to Repair a Corrupt Repository

How to Boot Without Starting Any Services

How to Boot in Verbose Mode

How to Force an sulogin Prompt If the system/filesystem/local:default Service Fails During Boot

3.  Using the Fault Manager

Index

Using Run Control Scripts

The following procedures show how to use run control scripts to stop or start a legacy service. Also included are instructions for adding or removing a run control script.

Using Run Control Scripts (Task Map)

The following task map includes several procedures that are associated with using run control scripts. Each row includes a task, a description of when you would want to perform that task, followed by a link to the task.

Task
Description
For Instructions
Stop or start a legacy service.
Use a run control script to stop or start a service.
Add a run control script.
Create a run control script and add it to the /etc/init.d directory.
Disable a run control script.
Disable a run control script by renaming the file.
Convert a run control script to use SMF.
Replaces the run control script with an SMF manifest so that the service can be managed by the SMF service.

How to Use a Run Control Script to Stop or Start a Legacy Service

  1. Become an administrator or assume a role that includes the Service Management rights profile.

    For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.

  2. Stop the system service.
    # /etc/init.d/filename stop
  3. Restart the system service.
    # /etc/init.d/filename start
  4. Verify that the service has been stopped or started.
    # pgrep -f service

Example 2-19 Using a Run Control Script to Stop or Start a Service

For example, you can stop the PPPoE server daemon by typing the following:

# /etc/init.d/pppd stop
# pgrep -f nfs

Then, you can restart the PPPoE server daemon by typing the following:

# /etc/init.d/pppd start
# pgrep -f ppp
101748
# pgrep -f ppp -d, | xargs ps -fp
     UID    PID   PPID   C    STIME TTY         TIME CMD
  daemon 101748      1   0   Sep 01 ?           0:06 /usr/lib/inet/pppoed

How to Add a Run Control Script

If you want to add a run control script to start and stop a service, copy the script into the /etc/init.d directory. Then, create links in the rcn .d directory where you want the service to start and stop.

See the README file in each /etc/rc n.d directory for more information on naming run control scripts. The following procedure describes how to add a run control script.

  1. Become an administrator or assume a role that includes the Service Management rights profile.

    For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.

  2. Add the script to the /etc/init.d directory.
    # cp filename/etc/init.d
    # chmod 0744 /etc/init.d/filename
    # chown root:sys /etc/init.d/filename
  3. Create links to the appropriate rcn.d directory.
    # cd /etc/init.d
    # ln filename /etc/rc2.d/Snnfilename
    # ln filename /etc/rcn.d/Knnfilename
  4. Verify that the script has links in the specified directories.
    # ls /etc/init.d/*filename /etc/rc2.d/*filename /etc/rcn.d/*filename

Example 2-20 Adding a Run Control Script

The following example shows how to add a run control script for the xyz service.

# cp xyz /etc/init.d
# chmod 0744 /etc/init.d/xyz
# chown root:sys /etc/init.d/xyz
# cd /etc/init.d
# ln xyz /etc/rc2.d/S99xyz
# ln xyz /etc/rc0.d/K99xyz
# ls /etc/init.d/*xyz /etc/rc2.d/*xyz /etc/rc0.d/*xyz

How to Disable a Run Control Script

You can disable a run control script by renaming it with an underscore (_) at the beginning of the file name. Files that begin with an underscore or dot are not executed. If you copy a file by adding a suffix to it, both files will be run.

  1. Become an administrator or assume a role that includes the Service Management rights profile.

    For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.

  2. Rename the script by adding an underscore (_) to the beginning of the new file.
    # cd /etc/rcn.d
    # mv filename_filename
  3. Verify that the script has been renamed.
    # ls _*
    _filename

Example 2-21 Disabling a Run Control Script

The following example shows how to rename the S99datainit script.

# cd /etc/rc2.d
# mv S99datainit _S99datainit
# ls _*
_S99datainit

How to Convert a Run Control Script to an SMF Service

This procedure shows how to use the advantages of SMF to support an existing run control script. See the svcbundle(1M) man page for more information.

Before You Begin

First, determine which service model the script needs. If the script does some work and then exits without starting any long running processes, it is most likely a transient service. If the script starts up a long running daemon and then exits, then it is a contract service. See the Duration section in the svc.startd(1M) man page for more information about service models.

Next, determine which run level is appropriate for the service. This can be determined by looking at which directory the script is linked into, for example /etc/rc3.d.

  1. Become an administrator or assume a role that includes the Service Management rights profile.

    For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.

  2. Create a temporary manifest.

    In this example, the service name is ex_svc. The is a contract service and runs at level 3.

    # svcbundle -o /tmp/ex_svc.xml -s service-name=ex_svc
          -s start-method=/lib/svc/method/ex_svc -s model=transient
  3. Make any additional changes to the manifest.

    Verify that the contents of manifest in /tmp/ex_svc.xml is what you need.

  4. Copy the manifest to the correct directory.
    # cp /tmp/ex_svc.xml /lib/svc/manifest/site/ex_svc.xml
  5. Stop the existing service.
    # /etc/init.d/ex_svc stop
  6. Disable the run control script.

    Remove any links to the run control script from the appropriate rcn.d directories.

  7. Import the manifest and start the service.
    # svcadm restart svc:/system/manifest-import