Sun Cluster 3.0 Data Services Developers' Guide

Stopping the Monitor

The MONITOR_STOP method uses pmfadm -q to see if the probe is running, and if so, uses pmfadm -s to stop it. If the probe is already stopped, the method exits successfully anyway, which guarantees the idempotency of the method.


# See if the monitor is running, and if so, kill it. 
if pmfadm -q $RESOURCE_NAME.monitor; then 
	pmfadm -s $RESOURCE_NAME.monitor KILL
	if [ $? -ne 0 ]; then 
			logger -p ${SYSLOG_FACILITY}.err \
				-t [$RESOURCETYPE_NAME,$RESOURCEGROUP_NAME,$RESOURCE_NAME] \
				"${ARGV0} Could not stop monitor for resource " \
				$RESOURCE_NAME
        	exit 1
	else
			# could successfully stop the monitor. Log a message.
			logger -p ${SYSLOG_FACILITY}.err \
				-t [$RESOURCETYPE_NAME,$RESOURCEGROUP_NAME,$RESOURCE_NAME] \
				"${ARGV0} Monitor for resource " $RESOURCE_NAME \
				" successfully stopped"
	fi
fi
exit 0


Caution - Caution -

Be certain to use the KILL signal with pmfadm to stop the probe and not a maskable signal such as TERM. Otherwise the MONITOR_STOP method can hang indefinitely and eventually time out. The reason for this problem is that the PROBE method calls scha_control when it is necessary to restart or fail over the data service. When scha_control calls MONITOR_STOP as part of the process of bringing the data service offline, if MONITOR_STOP uses a maskable signal, it hangs waiting for scha_control to complete and scha_control hangs waiting for MONITOR_STOP to complete.