11.3 Sample Load, Unload, and Monitor Scripts for a Cluster-Enabled NCP Volume

The settings in the sample scripts in this section are based on the values in Table 11-1. Make sure to replace the values with the settings from your own configuration.

Table 11-1 Sample Script Variables and Values

Variable

Template Value

Your Value

RESOURCE_IP

a.b.c.d

10.10.10.44

MOUNT_FS

reiserfs

ext3

container_name

name

csm44

MOUNT_DEV

/dev/evms/$container_name/volume_name

/dev/evms/$container_name/lxvol44

MOUNT_POINT

/mnt/mount_point

/mnt/lxvol44

NCP_VOLUME

volume_name

USERS

NCP_SERVER

ncp_server_name

cluster1_lxvol44_server

volume ID

VOL_ID

252

11.3.1 Sample Load Script for an NCP Volume Cluster Resource

You modify the load script for the cluster resource of the Linux POSIX file system by adding the extra lines needed for the NCP volume on it. The settings in the sample script are based on the values in Table 11-1. Make sure to replace the values with the settings from your own configuration.

#! /bin/bash
. /opt/novell/ncs/lib/ncsfuncs
# define the IP address
RESOURCE_IP=10.10.10.44
# define the file system type
MOUNT_FS=ext3
# define the container name
container_name=csm44
# define the device
MOUNT_DEV=/dev/evms/$container_name/lxvol44
# define the mount point
MOUNT_POINT=/mnt/lxvol44
# define NCP volume
NCP_VOLUME=USERS
# define NCP server name
NCP_SERVER=cluster1_lxvol44_server
# activate the container
exit_on_error activate_evms_container $container_name $MOUNT_DEV $NCS_TIMEOUT
# create the EVMS volume mount point if it does not exist
ignore_error mkdir -p $MOUNT_POINT
# mount the file system
exit_on_error mount_fs $MOUNT_DEV $MOUNT_POINT $MOUNT_FS
# add the IP address
exit_on_error add_secondary_ipaddress $RESOURCE_IP
# mount the NCP volume
exit_on_error ncpcon mount $NCP_VOLUME=252,PATH=$MOUNT_POINT
# bind the NCP volume
exit_on_error ncpcon bind --ncpservername=$NCP_SERVER --ipaddress=$RESOURCE_IP
exit 0

11.3.2 Sample Unload Script for an NCP Volume Cluster Resource

You modify the unload script for the cluster resource of the Linux POSIX file system by adding the extra lines needed for the NCP volume on it. The settings in the sample script are based on the values in Table 11-1. Make sure to replace the values with the settings from your own configuration.

#!/bin/bash
. /opt/novell/ncs/lib/ncsfuncs
# define the IP address
RESOURCE_IP=10.10.10.44
# define the file system type
MOUNT_FS=ext3
# define the container name
container_name=csm44
# define the device
MOUNT_DEV=/dev/evms/$container_name/lxvol44
# define the mount point
MOUNT_POINT=/mnt/lxvol44
# define NCP volume
NCP_VOLUME=USERS
# define NCP server name
NCP_SERVER=cluster1_lxvol44_server
# unbind the NCP volume
ignore_error ncpcon unbind --ncpservername=$NCP_SERVER --ipaddress=$RESOURCE_IP
# dismount the NCP volume
ignore_error ncpcon dismount $NCP_VOLUME
# if not using SMS for backup, comment out this sleep delay
sleep 10 
# unmount the volume
ignore_error umount_fs $MOUNT_DEV $MOUNT_POINT $MOUNT_FS
# del the IP address
ignore_error del_secondary_ipaddress $RESOURCE_IP
# deactivate the container
ignore_error deactivate_evms_container $container_name $NCS_TIMEOUT
# return status
exit 0

11.3.3 Sample Monitor Script for an NCP Volume Cluster Resource

You modify the monitor script for the cluster resource of the Linux POSIX file system by first enabling monitoring for the cluster resource, then modifying the variable values. The settings in the sample script are based on the values in Table 11-1. Make sure to replace the values with the settings from your own configuration.

#!/bin/bash
. /opt/novell/ncs/lib/ncsfuncs
# define the IP address
RESOURCE_IP=10.10.10.44
# define the file system type
MOUNT_FS=ext3
# define the container name
container_name=csm44
# define the device
MOUNT_DEV=/dev/evms/$container_name/lxvol44
# define the mount point
MOUNT_POINT=/mnt/lxvol44
# define NCP volume
NCP_VOLUME=lxvol44
# define NCP server name
NCP_SERVER=cluster1_lxvol44_server
# test the file system
exit_on_error status_fs $MOUNT_DEV $MOUNT_POINT $MOUNT_FS
# status the IP address
exit_on_error status_secondary_ipaddress $RESOURCE_IP
exit 0

To monitor the cluster resource, use the following in the monitor script:

exit_on_error ncpcon volume <volume_name>

To monitor the availability of NCP file services and it’s related services, use the following in the monitor script:

rcndsd status 
if test $? != 0; then 
    exit_on_error rcndsd restart 
fi 
sleep 5


exit_on_error rcndsd status 
/etc/init.d/ncp2nss status 
if test $? != 0; then 
    exit_on_error /etc/init.d/ncp2nss restart 
fi 
sleep 5
exit_on_error /etc/init.d/ncp2nss status