互联网服务crontab自动监控

写了个监控的shell ,望指点

刚写了个监控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...显示全部
刚写了个监控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 的?收起
参与2

查看其它 1 个回答stebay88的回答

stebay88stebay88工程师起点电脑
学习,以后可以用到的~
IT分销/经销 · 2010-12-15
浏览1333

回答者

stebay88
工程师起点电脑

stebay88 最近回答过的问题

回答状态

  • 发布时间:2010-12-15
  • 关注会员:0 人
  • 回答浏览:1333
  • X社区推广