A.10 ncs_resource_scripts.pl Script (Modifying Resource Scripts Outside of iManager)

You can use the /opt/novell/ncs/bin/ncs_resource_scripts.pl script to modify resource scripts without using iManager. You can add, remove, or modify the commands in the script, or retrieve its scripts to search for information from the script. You can issue the command from the command line or in a script. This capability is very useful when you need to make the same script change to multiple resources in a cluster.

Given a resource name, the ncs_resource_sripts.pl tool does one of two things:

  • Read: Retrieves the specified resource’s scripts and prints them to standard output.

  • Write: Gathers the script information from standard input and updates the specified resource’s scripts.

A.10.1 Syntax

At the command prompt on the master node of the cluster, enter the following command as the root user:

/opt/novell/ncs/bin/ncs_resource_scripts.pl <--help|-h|-?>
/opt/novell/ncs/bin/ncs_resource_scripts.pl [--read|--write] resource_name

You can redirect standard I/O to a file, and change the textual file any way you want.

A return code 0 indicates that the operation is successful. Otherwise, errors will be printed in standard error.

A.10.2 Options

--help, -h, -?

Prints usage help and exits.

--read

Retrieves the specified resource’s scripts and prints them to standard output.

You can redirect standard output to a file, and modify the scripts in the file.

--write

Gathers the script information from standard input and updates the specified resource’s scripts.

You can redirect standard input to a file that contains the modified scripts.

A.10.3 Examples

In the following examples, enter the /opt/novell/ncs/bin/ncs_resource_scripts.pl command at the command prompt on the master node of the cluster as the root user.

Example 1: Read the Scripts in Standard I/O

At the command prompt, enter the following commands to read and write the scripts to and from the same file:

/opt/novell/ncs/bin/ncs_resource_scripts.pl --read P_119_93_SERVER

Example 2: Redirect the Scripts from Standard I/O to a File

At the command prompt, enter the following commands to read and write the scripts to and from the same file:

# /opt/novell/ncs/bin/ncs_resource_scripts.pl --read POOL_01_SERVER > tmp.scripts

In a text editor, modify the scripts as needed in the output file tmp.scripts, then redirect the content of the modified file to be used with the --write option.

# /opt/novell/ncs/bin/ncs_resource_scripts.pl --write POOL_01_SERVER < tmp.scripts

Example 3: Delete the CIFS Workaround Line from Scripts

For scripts where an extra CIFS line was added as a workaround for a timing issue, remove the line. At the command prompt, enter the following command:

# /opt/novell/ncs/bin/ncs_resource_scripts.pl --read POOL_01_SERVER | sed '/novcifs -sln/d' | /opt/novell/ncs/bin/ncs_resource_scripts.pl --write POOL_01_SERVER

Example 4: Get the Volume Name from the Resource Load Script

Use grep with the ncs_resource_scripts.pl tool to parse the standard output and get the volume name from the ncpcon mount command in the resource load script. At the command prompt, enter the following command:

# /opt/novell/ncs/bin/ncs_resource_scripts.pl POOL_01_SERVER | grep -m1 -o "^exit_on_error[[:space:]]\+ncpcon[[:space:]]\+mount[[:space:]]\+\w\+" | cut -d' ' -f4