-
Notifications
You must be signed in to change notification settings - Fork 155
/
monitor_slice.ksh
56 lines (43 loc) · 1.12 KB
/
monitor_slice.ksh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/ksh
# Script Name : monitor_slice.ksh
# Author : Craig Richards
# Created : 14-June-2006
# Last Modified :
# Version : 1.0
# Modifications :
# Description : Shows the slice, as well as the GB of space used, as well as the space left, it will loop round and round until you cancel it running
#################################
# Start of procedures/functions #
#################################
funct_check_params()
{
if [ ${NARG} -ne 1 ]; then
echo "Monitor Slice Failed : You need to enter the slice you want to monitor" >> $LOGFILE
exit 1
fi
}
funct_check_slice()
{
AVAIL=`df -k ${SLICE}| cut -f1 -d"l"| awk '{ print $4 }'` ; export AVAIL
echo "Slice \t\t GB Used"
echo "===== \t\t ======="
while [[ 1 == 1 ]];
do
du -ks ${SLICE} | awk '{ print $2 "\t" $1/(1024*1024) }'
sleep 30
echo " Space left in KB on ${SLICE} :" ${AVAIL}
done
}
################
# Main Program #
################
# Variable Settings
NARG=$# ; export NARG
DATE=`date +"%d-%B-%Y"` ; export DATE
SLICE=$1 ; export SLICE
# Oracle Environment
{
funct_check_params
funct_check_slice
}
## End of Script