![]() |
![]() |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
RCM Script TasksThe following sections describe the RCM script tasks for application developers and system administrators. Application Developer RCM Script (Task Map)The following task map describes the tasks for an application developer who is creating an RCM script.
System Administrator RCM Script (Task Map)The following task map describes the tasks for a system administrator who is creating an RCM script to do site customization.
Naming an RCM ScriptA script must be named as vendor,service where the following applies:
Installing or Removing an RCM ScriptYou must be superuser (root) to install or remove an RCM script. Use this table to determine where you should install your RCM script. Table 28-1 RCM Script Directories
|
# cp SUNW,sample.pl /usr/lib/rcm/scripts |
Change the user ID and the group ID of the script to the desired values.
# chown user:group /usr/lib/rcm/scripts/SUNW,sample.pl |
Send SIGHUP to the RCM daemon.
# pkill -HUP -x -u root rcm_daemon |
How to Remove an RCM ScriptBecome superuser.
Remove the script from the RCM script directory.
For example:
# rm /usr/lib/rcm/scripts/SUNW,sample.pl |
Send SIGHUP to the RCM daemon.
# pkill -HUP -x -u root rcm_daemon |
How to Test an RCM ScriptSet environment variables, such as RCM_ENV_FORCE, in the command-line shell before running your script.
For example, in the Korn shell, use the following:
$ export RCM_ENV_FORCE=TRUE |
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 |
Make sure each RCM script command in your script prints appropriate output to stdout.
Install the script in the appropriate script directory.
For more information, see How to Install an RCM Script.
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 - Make sure that you are familiar with these commands because
they can alter the state of the system and can cause system failures.
This example illustrates how to use an RCM script for tape backups.
The tape backup RCM script performs the following steps:
Sets up a dispatch table of RCM commands.
Calls the dispatch routine that corresponds to the specified RCM command and exits with status 2 for unimplemented RCM commands.
Sets up the scriptinfo section:
rcm_script_func_info=Tape backup appl script for DR |
Registers all tape drives in the system by printing all tape drive device names to stdout.
rcm_resource_name=/dev/rmt/$f |
rcm_failure_reason=$errmsg |
Sets up the resource information for the tape device.
rcm_resource_usage_info=Backup Tape Unit Number $unit |
Sets up the preremove information by checking if the backup application is using the device. If the backup application is not using the device, the dynamic reconfiguration operation continues. If the backup application is using the device, the script checks RCM_ENV_FORCE. If RCM_ENV_FORCE is set to FALSE, the script denies the dynamic reconfiguration operation and prints the following message:
rcm_failure_reason=tape backup in progress pid=... |
If RCM_ENV_FORCE is set to TRUE, the backup application is stopped, and the reconfiguration operation proceeds.
Previous Contents Index Next ![]() |