source: gpfs_3.1_ker2.6.20/lpp/mmfs/bin/mmpmon

Last change on this file was 16, checked in by rock, 17 years ago
  • Property svn:executable set to *
File size: 3.4 KB
Line 
1#!/bin/ksh
2# IBM_PROLOG_BEGIN_TAG
3# This is an automatically generated prolog.
4
5
6
7# Licensed Materials - Property of IBM
8
9# (C) COPYRIGHT International Business Machines Corp. 2004,2005
10# All Rights Reserved
11
12# US Government Users Restricted Rights - Use, duplication or
13# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
14
15# IBM_PROLOG_END_TAG
16# @(#)85 1.4.1.5 src/avs/fs/mmfs/ts/admin/mmpmon.sh, mmfs, avs_rgpfs24, rgpfs240610b 6/16/05 01:55:25
17#######################################################################
18#
19# Usage:  mmpmon [-d integerDelayValue] [-i fileName] [-p]
20#                [-r integerRunValue] [-s] [-t timeout_in_sec]
21#
22#######################################################################
23
24# Include global declarations and service routines
25. /usr/lpp/mmfs/bin/mmglobfuncs
26. /usr/lpp/mmfs/bin/mmsdrfsdef
27. /usr/lpp/mmfs/bin/mmfsfuncs
28
29sourceFile="mmpmon.sh"
30[[ -n $DEBUG || -n $DEBUGmmpmon ]] && set -x
31$mmTRACE_ENTER "$*"
32
33###################################
34# Set up trap exception handling.
35###################################
36trap pretrap2 HUP INT QUIT KILL
37
38# Local variables
39
40usageMsg=186
41noUsageMsg=0
42integer rc=0
43integer delayValue=1000  # default value for delay (1000 ms)
44integer runValue=1       # default value for run
45parsable="0"             # default to human-readable output.
46emitPrompts="1"          # default value for no explicit file name.
47fileName=""
48timeout_in_sec=60
49
50##################################
51# Get the correct socket name.
52##################################
53useThisNamedSocket=$mmpmonNamedSocketFile
54
55##################################
56# Process the command arguments.
57##################################
58[[ $arg1 = '-?' || $arg1 = '-h' || $arg1 = '--help' || $arg1 = '--' ]] && \
59  syntaxError "help" $usageMsg
60
61# Parse the optional parameters.
62while getopts :d:i:psr:t: OPT
63do
64  case $OPT in
65    d) delayValue=$(checkIntRange "-d" $OPTARG 500 8000000)
66       [[ $? -ne 0 ]] && cleanupAndExit
67       ;;
68
69    i) [[ -n $fileName ]] && syntaxError "multiple" $noUsageMsg "-$OPT"
70       emitPrompts="0"
71       fileName=$OPTARG
72       if [[ ! -r $fileName ]]
73       then
74         # Cannot open the file
75         printErrorMsg 43 $mmcmd $fileName
76         cleanupAndExit
77       fi
78       ;;
79 
80    p) parsable="1"
81       ;;
82
83    r) runValue=$(checkIntRange "-r" $OPTARG 0 8000000)
84       [[ $? -ne 0 ]] && cleanupAndExit
85       ;;
86
87    s) emitPrompts="0"
88       ;;
89
90    t) timeout_in_sec=$(checkIntRange "-t" $OPTARG 1 8000000)
91       [[ $? -ne 0 ]] && cleanupAndExit
92       ;;
93
94    +[diprst]) # invalid option specified
95       syntaxError "invalidOption" $usageMsg $OPT
96       ;;
97
98    :) # missing required value after an option
99       syntaxError "missingValue" $usageMsg $OPTARG
100       ;;
101
102    *) # invalid option specified
103       syntaxError "invalidOption" $usageMsg $OPTARG
104       ;;
105  esac
106done
107shift OPTIND-1
108[[ $# != 0 ]] && syntaxError "extraArg" $usageMsg $1
109
110if [[ -n $DEBUG || -n $DEBUGmmpmon ]]
111then
112  debugOption="1"
113else
114  debugOption="0"
115fi
116
117###################################
118# Invoke the tspmon command.
119###################################
120if [[ -n $fileName ]]
121then
122  ${mmcmdDir}/${links}/mmpmon \
123    $delayValue $parsable $runValue $debugOption $emitPrompts  \
124    $timeout_in_sec $useThisNamedSocket < $fileName
125  rc=$?
126else
127  ${mmcmdDir}/${links}/mmpmon \
128    $delayValue $parsable $runValue $debugOption $emitPrompts  \
129    $timeout_in_sec $useThisNamedSocket
130  rc=$?
131fi
132
133cleanupAndExit $rc
134
Note: See TracBrowser for help on using the repository browser.