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 the following table. Ensure that you replace the values with the settings from your own configuration.

Variable

Template Value

Your Value

RESOURCE_IP

a.b.c.d

10.10.10.44

MOUNT_FS

reiserfs

ext3

VOLGROUP_NAME

LVM volume group name

myclustervg01

MOUNT_DEV

/dev/VOLGROUP_NAME/volumename

/dev/$VOLGROUP_NAME/myclustervol01

MOUNT_POINT

/mnt/mount_point

/mnt/myclustervol01

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 Section 11.3, Sample Load, Unload, and Monitor Scripts for a Cluster-Enabled NCP Volume. Ensure that you 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 volume group name
VOLGROUP_NAME=myclustervg01

# define the device
MOUNT_DEV=/dev/$VOLGROUP_NAME/volume_name

# define the mount point
MOUNT_POINT=/mnt/mount_point
# activate the volume group
exit_on_error vgchange -a ey $VOLGROUP_NAME 
# 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 Section 11.3, Sample Load, Unload, and Monitor Scripts for a Cluster-Enabled NCP Volume. Ensure that you 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 volume group name
VOLGROUP_NAME=name

# 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
sleep 10 # if not using SMS for backup, please comment out this line
exit_on_error umount_fs $MOUNT_DEV $MOUNT_POINT $MOUNT_FS
#deactivate the volume group
exit_on_error vgchange -a n $VOLGROUP_NAME

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 Section 11.3, Sample Load, Unload, and Monitor Scripts for a Cluster-Enabled NCP Volume. Ensure that you 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 volume group name
VOLGROUP_NAME=name

# define the device
MOUNT_DEV=/dev/$VOLGROUP_NAME/volume_name

# define the mount point
MOUNT_POINT=/mnt/mount_point

# 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
# check the logical volume
exit_on_error status_lv $MOUNT_DEV
exit 0

Monitoring the Cluster Resource

Add the following line to the monitor script:

exit_on_error ncpcon volume <volume_name>

Monitoring the Availability of NCP File Services

Add the following lines to 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