Solaris 8 System Administration Supplement

RCM Script Tasks

The following sections describe the RCM script tasks for application developers and system administrators.

Application Developer RCM Script Tasks

The following table describes the tasks for an application developer who is creating an RCM script.

Table 17–1 Application Developer RCM Script Task Map

Task 

Description 

For Instructions, Go To 

1. Identify Resources Your Application Uses 

Identify the resources (device names) your application uses that you could potentially dynamically remove. 

cfgadm(1m) man page

2. Identify Commands to Release the Resource 

Identify the commands for notifying the application to cleanly release the resource from the application. 

Application documentation 

3. Identify Commands for Post-Removal of the Resource 

Include the commands for notifying the application of the resource removal. 

rcmscript(4) man page

4. Identify Commands If the Resource Removal Fails 

Include the commands for notifying the application of the available resource.  

rcmscript(4) man page

5. Write the RCM Script 

 

Tape Backup RCM Script Example

6. Install the RCM Script 

Add the script to the appropriate script directory. 

How to Install an RCM Script

7. Test the RCM Script 

Test the script by running the script commands manually and by initiating a dynamic reconfiguration operation. 

How to Test an RCM Script

System Administrator RCM Script Tasks

The following table describes the tasks for a system administrator who is creating an RCM script to do site customization.

Table 17–2 System Administrator RCM Script Task Map

Task 

Description 

For Instructions, Go To 

1. Identify Resources to Be Dynamically Removed 

Identify the resources (device names) to be potentially removed by using the cfgadm -l command.

cfgadm(1m) man page

2. Identify Applications to Be Stopped 

Identify the commands for stopping the applications cleanly. 

Application documentation 

3. Identify Commands For Pre- and Post-Removal of the Resource 

Identify the actions to be taken before and after the resource is removed. 

rcmscript(4) man page

4. Write the RCM Script 

 

Tape Backup RCM Script Example

5. Install the RCM Script 

Add the script to the appropriate script directory. 

How to Install an RCM Script

6. Test the RCM Script 

Test the script by running the script commands manually and by initiating a dynamic reconfiguration operation. 

How to Test an RCM Script

Naming an RCM Script

A script must be named as vendor,service where the following applies:

vendor

Is the stock symbol of the vendor that provides the script, or any distinct name that identifies the vendor. 

service

Is the name of the service that the script represents. 

Installing or Removing an RCM Script

You must be superuser (root) to install or remove an RCM script. Use this table to determine where you should install your RCM script.

Table 17–3 RCM Script Directories

Directory Location 

Script Type 

/etc/rcm/scripts

Scripts for specific systems 

/usr/platform/`uname -i`/lib/rcm/scripts

Scripts for a specific hardware implementation 

/usr/platform/`uname -m`/lib/rcm/scripts

Scripts for a specific hardware class 

/usr/lib/rcm/scripts

Scripts for any hardware 

How to Install an RCM Script

  1. Become superuser.

  2. Copy the script to the appropriate directory as described in Table 17–3.

    For example:


    # cp SUNW,sample.pl /usr/lib/rcm/scripts
    
  3. Change the user ID and the group ID of the script to the desired values.

    For example:


    # chown user:group /usr/lib/rcm/scripts/SUNW,sample.pl
    
  4. Send SIGHUP to the RCM daemon.


    # pkill -HUP -x -u root rcm_daemon
    

How to Remove an RCM Script

  1. Become superuser.

  2. Remove the script from the RCM script directory.

    For example:


    # rm /usr/lib/rcm/scripts/SUNW,sample.pl 
    
  3. Send SIGHUP to the RCM daemon.


    # pkill -HUP -x -u root rcm_daemon
    

How to Test an RCM Script

  1. Set environment variables, such as RCM_ENV_FORCE, on the command-line shell before running your script.

    For example, in the Korn shell, use:


    $ export RCM_ENV_FORCE=TRUE
    
  2. Test the script by running the script commands manually from the command line.

    For example:


    $ script-name scriptinfo
    $ script-name register
    $ script-name preremove resource-name
    $ script-name postremove resource-name
    
  3. Make sure each RCM script command in your script prints appropriate output to stdout.

  4. Install the script in the appropriate script directory.

    See How to Install an RCM Script for more information.

  5. Test the script by initiating a dynamic remove operation:

    For example, assume your script registers the device, /dev/dsk/c1t0d0s0. Try these commands.


    $ cfgadm -c unconfigure c1::dsk/c1t0d0
    $ cfgadm -f -c unconfigure c1::dsk/c1t0d0
    $ cfgadm -c configure c1::dsk/c1t0d0
    

    Caution – Caution –

    Make sure you are familiar with these commands because they can alter the state of the system and can cause system failures.