#!/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # # # Licensed Materials - Property of IBM # # (C) COPYRIGHT International Business Machines Corp. 2004,2005 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # @(#)85 1.4.1.5 src/avs/fs/mmfs/ts/admin/mmpmon.sh, mmfs, avs_rgpfs24, rgpfs240610b 6/16/05 01:55:25 ####################################################################### # # Usage: mmpmon [-d integerDelayValue] [-i fileName] [-p] # [-r integerRunValue] [-s] [-t timeout_in_sec] # ####################################################################### # Include global declarations and service routines . /usr/lpp/mmfs/bin/mmglobfuncs . /usr/lpp/mmfs/bin/mmsdrfsdef . /usr/lpp/mmfs/bin/mmfsfuncs sourceFile="mmpmon.sh" [[ -n $DEBUG || -n $DEBUGmmpmon ]] && set -x $mmTRACE_ENTER "$*" ################################### # Set up trap exception handling. ################################### trap pretrap2 HUP INT QUIT KILL # Local variables usageMsg=186 noUsageMsg=0 integer rc=0 integer delayValue=1000 # default value for delay (1000 ms) integer runValue=1 # default value for run parsable="0" # default to human-readable output. emitPrompts="1" # default value for no explicit file name. fileName="" timeout_in_sec=60 ################################## # Get the correct socket name. ################################## useThisNamedSocket=$mmpmonNamedSocketFile ################################## # Process the command arguments. ################################## [[ $arg1 = '-?' || $arg1 = '-h' || $arg1 = '--help' || $arg1 = '--' ]] && \ syntaxError "help" $usageMsg # Parse the optional parameters. while getopts :d:i:psr:t: OPT do case $OPT in d) delayValue=$(checkIntRange "-d" $OPTARG 500 8000000) [[ $? -ne 0 ]] && cleanupAndExit ;; i) [[ -n $fileName ]] && syntaxError "multiple" $noUsageMsg "-$OPT" emitPrompts="0" fileName=$OPTARG if [[ ! -r $fileName ]] then # Cannot open the file printErrorMsg 43 $mmcmd $fileName cleanupAndExit fi ;; p) parsable="1" ;; r) runValue=$(checkIntRange "-r" $OPTARG 0 8000000) [[ $? -ne 0 ]] && cleanupAndExit ;; s) emitPrompts="0" ;; t) timeout_in_sec=$(checkIntRange "-t" $OPTARG 1 8000000) [[ $? -ne 0 ]] && cleanupAndExit ;; +[diprst]) # invalid option specified syntaxError "invalidOption" $usageMsg $OPT ;; :) # missing required value after an option syntaxError "missingValue" $usageMsg $OPTARG ;; *) # invalid option specified syntaxError "invalidOption" $usageMsg $OPTARG ;; esac done shift OPTIND-1 [[ $# != 0 ]] && syntaxError "extraArg" $usageMsg $1 if [[ -n $DEBUG || -n $DEBUGmmpmon ]] then debugOption="1" else debugOption="0" fi ################################### # Invoke the tspmon command. ################################### if [[ -n $fileName ]] then ${mmcmdDir}/${links}/mmpmon \ $delayValue $parsable $runValue $debugOption $emitPrompts \ $timeout_in_sec $useThisNamedSocket < $fileName rc=$? else ${mmcmdDir}/${links}/mmpmon \ $delayValue $parsable $runValue $debugOption $emitPrompts \ $timeout_in_sec $useThisNamedSocket rc=$? fi cleanupAndExit $rc