System Administration Guide: Basic Administration

ProcedureHow 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 superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: 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 rc n.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 19–16 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