分类:
2008-05-10 18:16:59
-------------------------------------------------------------------------------- #!/bin/sh #Filename:whatever_you_name_it DIRS="/etc/home/bin/sbin/usr/bin/usr/sbin/usr/local/var/your_directory" ADMIN="email@your.domain.com" FROM="admin@your.domain.com" #写入Sendmail的标头 echo"Subject:$HOSTNAMEfilesystemcheck">/tmp/today.mail echo"From:$FROM">>/tmp/today.mail echo"To:$ADMIN">>/tmp/today.mail echo"Thisisfilesystemreportcomesfrom$HOSTNAME">>/tmp/today.mail #报告目前正在执行的程式 psaxf>>/tmp/today.mail #档案系统检查 echo"FileSystemCheck">>/tmp/today.mail ls-alR$DIRS|gzip-9>/tmp/today.gz zdiff/tmp/today.gz/tmp/yesterday.gz>>/tmp/today.mail mv-f/tmp/today.gz/tmp/yesterday.gz #寄出信件 sendmail-t 然後把它放到一个不显眼的地方去,让别人找不到。 把它加入crontab中。 307***/full_check_script_path/whatever_you_name_it1>/dev/null2>/dev/null#上班前检查 有些档案是固定会更动的,像/var/log/messages、/var/log/syslog、/dev/ttyX等等,不要太大惊小怪。 |