#!/bin/sh # # $Header: agentok.sh 14-apr-2005.03:01:04 sksaha Exp $ # # agentok.sh # # Copyright (c) 2002, 2005, Oracle. All rights reserved. # # NAME # agentok.sh - determines if adequate resources are available for agent # # DESCRIPTION # Performs a series of tests to determin whether adequate resources like # swap space etc. are available. This is so that the agent does not enter # a thrashing scenario and quit. # # NOTES # # # MODIFIED (MM/DD/YY) # sksaha 04/14/05 - Evaluate swap space using free in linux # njagathe 09/16/03 - Reset LC_ALL to prevent locale issues with # njagathe 09/02/02 - Add PATH setting # vnukal 08/23/02 - vnukal_bug-2505784 # vnukal 08/23/02 - review comments # vnukal 08/09/02 - Creation # PATH=/usr/sbin:/bin export PATH LC_ALL=C export LC_ALL ####################### # SWAP COMPUTATION ####################### #The following command extracts the total swap space available (in KB) #according to the 'swap -s' command. uname=`uname` if [ "$uname" = "Linux" ] then swapavail=`/usr/bin/free | grep Swap | awk '{print $4}'` else swapavail=`swap -s | cut -f 11 -d ' ' | sed 's/k//' ` fi # for the time being we hard-code the required swap space. But it should be # accepted as a parameter when we have adaptive required swap space # computation. # 102400 is 100 MB as units are in KB. if [ "$EMD_MIN_SWAP_REQUIRED" = "" ] then EMD_MIN_SWAP_REQUIRED=102400 fi echo -- Swap available is $swapavail -- if [ "$swapavail" -lt "$EMD_MIN_SWAP_REQUIRED" ] then echo -- `date` Insufficient swap for starting agent. -- exit 1 else echo -- `date` Sufficient swap space found. -- fi ## DONE SWAP COMPUTATION TEST # Additional tests are added here exit 0