刚写了个监控aix 文件系统的shell , 望大家看看,还有什么好的建议,先谢过。
下面的shell ,我再小鸡上是可以通过的:
1: check file 的shell: /tmp/test/test01.sh
#! /bin/ksh
# Function: This shell is to check the file system for monotoring
# Date: Oct 17 2010
# Author:
df -g > checkfile
grep '/dev/hd2' checkfile > ch01
awk '{$print $4}' ch01 > ch02
ch03=ch02
ch04=`cat $ch03`
if [ "$ch04" -ge 50 ]; then
echo "the file system is so bog than explend the file system"
else
echo "okay now, continue to work! ^ - ^"
fi
2: 利用crontab 来定义 shell 的运行规律:
写一个frequently shell: fre.sh ,放在/tmp/test
(每5 分钟执行一下test01.sh)
#cat fre.sh
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /tmp/test/test01.sh (在linux 下可以用*/5 * * * * /tmp/test/test01.sh)
3:在aix 系统中定制这个fre.sh
#crontab /tmp/test/fre.sh
4: 经测试,在/usr/spool/mail/root 中有刚才test 的结果,
我就想如果是在某一个文件系统下backup一个大文件,除了显示警告以外,当然还可以把上一个timestamp 的文件 delete, 也可以把它move 到其他的文件夹,
不知道还有什么其他的经验可以share 的?
收起