#!/usr/bin/ksh stopHost=loremds20 mmtrace=/usr/lpp/mmfs/bin/mmtrace mmtracectl=/usr/lpp/mmfs/bin/mmtracectl # No automatic start of mmtrace. # Second to sleep between checking. secondsToSleep=2 # Flag to know when tripped or stopped tripped=0 # mmfs log file to monitor logToGrep=/var/log/messages # Path to mmfs bin directory MMFSbin=/usr/lpp/mmfs/bin # Trip file. Will exist if trap is sprung trapHasSprung=/tmp/mmfsTrapHasSprung rm $trapHasSprung 2>/dev/null # Start tracing on this node #${mmtrace} start # Initial count of expelled message in mmfs log baseCount=$(grep "unmounted by the system with return code 301 reason code" $logToGrep | wc -l) # do this loop while the trip file does not exist while [[ ! -f $trapHasSprung ]] do sleep $secondsToSleep # Get current count of expelled to check against the initial. currentCount=$(grep "unmounted by the system with return code 301 reason code" $logToGrep | wc -l) if [[ $currentCount > $baseCount ]] then tripped=1 /usr/lpp/mmfs/bin/mmdsh -N managernodes,quorumnodes touch $trapHasSprung # cluster manager? #stopHost=$(/usr/lpp/mmfs/bin/tslsmgr | grep '^Cluster manager' | awk '{ print $NF }' | sed -e 's/[()]//g') ssh $stopHost flock -xn /tmp/mmfsTraceStopLock -c "'/usr/lpp/mmfs/bin/mmdsh -N all -f128 /usr/lpp/mmfs/bin/mmtrace stop noformat'" fi done