#!/bin/ksh
# @(#)41        1.2  src/avs/fs/mmfs/ts/config/mmfsdown.sample, mmfs, avs_rgpfs24, rgpfs240610b 1/27/06 16:14: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 the automatic trace handling on a particular node,
# 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/mmfsdown
#   c) ensure this script is executable (chmod +x /var/mmfs/etc/mmfsdown)
#
##############################################################################

# Process the parameters.
status=$1  # Possible values are "active" or "down".


# osName=$(/bin/uname -s)

# if [[ $osName = Linux ]]
# then
#   FSTYPE=gpfs
#   UMOUNTALL="/bin/umount -a"
#   # Note: Do not redirect stderr on Linux umount.
#   STDERR_REDIRECT=""
# fi

# if [[ $osName = AIX ]]
# then
#   FSTYPE=mmfs
#   UMOUNTALL="/usr/sbin/umount"
#   STDERR_REDIRECT="2>/dev/null"
# fi


# if [[ $status = active ]]
# then
#   # The GPFS daemon died but will be restarted.

#   # Optional unmount of all GPFS file systems (uncomment the umount line).
#   # The GPFS daemon will remount anything left mounted in VFS.
#   # For multi-node recovery, there may be reasons to force the unmount now.

#   # Uncomment the next line for unforced unmount.
#   # Busy file systems will not unmount.
#   #$(eval $UMOUNTALL -t $FSTYPE $STDERR_REDIRECT)
  
#   # Uncomment the next line for forced unmount.
#   #$UMOUNTALL -f -t $FSTYPE

#   # Do any commands here to clean up local state
#   # before the GPFS daemon restarts.

# else

#   # GPFS daemon is shutting down.

#   # Do any commands here to clean up local state
#   # when the GPFS daemon is shutting down.
# fi

return 0
