source: gpfs_3.1_ker2.6.20/lpp/mmfs/samples/nfscluster/preunmount @ 108

Last change on this file since 108 was 16, checked in by rock, 17 years ago
  • Property svn:executable set to *
File size: 2.8 KB
Line 
1#!/bin/ksh
2# @(#)84        1.5.1.6  src/avs/fs/mmfs/samples/nfscluster/preunmount, mmfs, avs_rgpfs24, rgpfs24s010a 1/29/07 03:24:33
3##############################################################################
4#
5# When properly installed, this script is invoked by the GPFS daemon during
6# normal or abnormal shutdown cleanup processing.
7#
8# The script is invoked with one parameter which represents the status of
9# the GPFS daemon.  The possible values are:
10#   down    - this is normal shutdown processing as a result of a mmshutdown
11#             command.  The GPFS daemon will not be restarted.
12#   active  - this is abnormal shutdown processing as a result of some
13#             unrecoverable condition.  The GPFS daemon will be restarted.
14#
15# If this is a normal shutdown, GPFS has already unmounted all file systems.
16#
17# If this is abnormal shutdown, GPFS leaves the file systems mounted and
18# will attempt to remount them after the daemon restarts.  If you do not
19# wish the file systems to be automatically remounted, add the appropriate
20# umount commands in this script.
21#
22# You can also use this script to add any commands to clean up local state
23# before the GPFS daemon restarts.
24#
25# If GPFS was started with the -T option (activate tracing) on the mmstartup
26# command, trace records have already been cut prior to invoking this script.
27# If you want to disable on a particular node the automatic trace handling,
28# run the following command on the desired nodes:
29#      touch /var/mmfs/etc/ignoreMMTRACE
30#
31# If you have disabled the automatic trace handling, or if you have started
32# tracing with the mmtrace command, add the appropriate trace handling commands.
33#
34#
35# To activate the code:
36#
37#   a) edit this script and make the appropriate changes
38#   b) copy this script to /var/mmfs/etc/preunmount
39#   c) ensure this script is executable (chmod +x preunmount)
40#
41##############################################################################
42
43# Process the parameters.
44if [ ! -f /var/mmfs/etc/nfsfuncs ]; then
45    echo "$0: Can't find NFS functions in /var/mmfs/etc"
46    exit 0
47fi
48. /var/mmfs/etc/nfsfuncs
49
50device=$1
51reason=$2
52debugmsg $0: device=$device reason=$reason
53
54# stop NFS only if the devide was exported or used for HA-NFS shared information
55if [[ "$reason" == "SGPanic" ]]; then
56    isExported $device
57    rc1=$?
58    isSharedRoot $device
59    rc2=$?
60    if [[ $rc1 -ne 0 && $rc2 -ne 0 ]]; then
61        debugmsg $0: ignore device=$device umount
62        return 0
63    fi
64fi
65
66if [[ "$reason" == "SGPanic" || "$reason" == "Shutdown" || "$reason" == "umount" ]]; then
67  /var/mmfs/etc/nfsmonitor -e
68  /var/mmfs/etc/stop.nfs
69fi
70
71if [[ "$reason" == "SGPanic" ]]; then
72  debuglog touch /tmp/ha-nfs-reboot
73  debugmsg "Stopping GPFS..."
74  if [[ "$REBOOT" == "1" ]]; then
75    reboot -f
76  else
77    /etc/init.d/gpfs stop
78  fi
79fi
80
81if [[ "$reason" == "Shutdown" ]]; then
82  _unlink /tmp/ha-nfs-reboot
83fi
84
85return 0
Note: See TracBrowser for help on using the repository browser.