现在公司的 oracle 文件的 归档filesystem 下太大了,而且要是录用达到100% oracle 的用户是connect 不上去的,于是决定 写个监控的shell:
思想: 归档的日志有大有小,当filesystem 在20% 一下就可以认为正常,不要删除,否则就要delete old files.
1:好下面来看以下shell: (是放在/tmp/test/monitor.sh)
#! /bin/ksh
# Function: This shell is to monitor the filesystem.
# Date: Dev 05 2010 sunny Sunday
# step1 To to check the filesytem, if it more than 20%,then delete the old files, otherwise to do nothing.
df -g > checkfile
grep '/dev/arch' checkfile > ch01
awk '{$print $4}' ch01 > ch02
ch03=ch02
ch04 = `cat $ch03`
if [ "$ch04" -ge 20 ]; then
continue
else
echo "The file system is okay now ,please contunie to work! ^_^ "