1
0
Files
irix-657m-src/irix/cmd/stress/mfg/scripts/swapMem
2022-09-29 17:59:04 +03:00

38 lines
826 B
Tcsh
Executable File

#! /bin/csh
#
# Script: swapMem
# Purpose: To return the amount of swap : in use; total; or available
# Parameters: -t - return total
# -f - return free
# -u - return used
#
# Notes: If more than 1 option is given, each on is processed in order, and the
# respective values are returned on stdout 1 per line.
@ i = 1
while ($i <= $#argv)
set swapstr = `swap -sb`
@ used = `echo $swapstr | awk '{print $9}'`
@ free = `echo $swapstr | awk '{print $12}'`
@ total= $free + $used
# Scale into MB
@ used = $used / (1024 * 1024 / 512)
@ free = $free / (1024 * 1024 / 512)
@ total= $total / (1024 * 1024 / 512)
switch($argv[$i])
case '-t':
echo $total
breaksw
case '-f':
echo $free
breaksw
case '-u':
echo $used
breaksw
default:
echo Invalid option $argv[$i]
exit 1
endsw
@ i++
end