#!/bin/ksh # @(#)84 1.5.1.6 src/avs/fs/mmfs/samples/nfscluster/preunmount, mmfs, avs_rgpfs24, rgpfs24s010a 1/29/07 03:24:33 ############################################################################## # # When properly installed, this script is invoked by the GPFS daemon during # normal or abnormal shutdown cleanup processing. # # The script is invoked with one parameter which represents the status of # the GPFS daemon. The possible values are: # down - this is normal shutdown processing as a result of a mmshutdown # command. The GPFS daemon will not be restarted. # active - this is abnormal shutdown processing as a result of some # unrecoverable condition. The GPFS daemon will be restarted. # # If this is a normal shutdown, GPFS has already unmounted all file systems. # # If this is abnormal shutdown, GPFS leaves the file systems mounted and # will attempt to remount them after the daemon restarts. If you do not # wish the file systems to be automatically remounted, add the appropriate # umount commands in this script. # # You can also use this script to add any commands to clean up local state # before the GPFS daemon restarts. # # If GPFS was started with the -T option (activate tracing) on the mmstartup # command, trace records have already been cut prior to invoking this script. # If you want to disable on a particular node the automatic trace handling, # run the following command on the desired nodes: # touch /var/mmfs/etc/ignoreMMTRACE # # If you have disabled the automatic trace handling, or if you have started # tracing with the mmtrace command, add the appropriate trace handling commands. # # # To activate the code: # # a) edit this script and make the appropriate changes # b) copy this script to /var/mmfs/etc/preunmount # c) ensure this script is executable (chmod +x preunmount) # ############################################################################## # Process the parameters. if [ ! -f /var/mmfs/etc/nfsfuncs ]; then echo "$0: Can't find NFS functions in /var/mmfs/etc" exit 0 fi . /var/mmfs/etc/nfsfuncs device=$1 reason=$2 debugmsg $0: device=$device reason=$reason # stop NFS only if the devide was exported or used for HA-NFS shared information if [[ "$reason" == "SGPanic" ]]; then isExported $device rc1=$? isSharedRoot $device rc2=$? if [[ $rc1 -ne 0 && $rc2 -ne 0 ]]; then debugmsg $0: ignore device=$device umount return 0 fi fi if [[ "$reason" == "SGPanic" || "$reason" == "Shutdown" || "$reason" == "umount" ]]; then /var/mmfs/etc/nfsmonitor -e /var/mmfs/etc/stop.nfs fi if [[ "$reason" == "SGPanic" ]]; then debuglog touch /tmp/ha-nfs-reboot debugmsg "Stopping GPFS..." if [[ "$REBOOT" == "1" ]]; then reboot -f else /etc/init.d/gpfs stop fi fi if [[ "$reason" == "Shutdown" ]]; then _unlink /tmp/ha-nfs-reboot fi return 0