[Shell] Monitor filesystem usage & delete expire file
[root@oracle6 source]# crontab -l
5,15,25,35,45,55 * * * * /home/mon/source/mon_filesystem_full >> /home/mon/log/mon_filesystem_full.log
[root@oracle6 source]#
[root@oracle6 source]#
[root@oracle6 source]# more mon_filesystem_full
#!/bin/bash
#monitor local filesystem is fully
LOG=/home/mon/data/filesystem_full.txt
FILE=/u01/oracle/product/11.2.0/dbhome_1/dbs
df -P > $LOG
cat $LOG | grep % | while
read LINE
do
PCT=`echo $LINE | awk '{print $5}'`
PCTD=`echo $PCT | tr "%" " "`
if [ $PCTD -gt 64 ]; then
#echo "$PCTD"
ls -tr $FILE/arch*dbf | head -10 | while
read NAME
do
#echo "$NAME"
rm $NAME
done
fi
done
find $FILE -name "arch*dbf" -mtime +30 -type f -exec rm -rf {} \;
5,15,25,35,45,55 * * * * /home/mon/source/mon_filesystem_full >> /home/mon/log/mon_filesystem_full.log
[root@oracle6 source]#
[root@oracle6 source]#
[root@oracle6 source]# more mon_filesystem_full
#!/bin/bash
#monitor local filesystem is fully
LOG=/home/mon/data/filesystem_full.txt
FILE=/u01/oracle/product/11.2.0/dbhome_1/dbs
df -P > $LOG
cat $LOG | grep % | while
read LINE
do
PCT=`echo $LINE | awk '{print $5}'`
PCTD=`echo $PCT | tr "%" " "`
if [ $PCTD -gt 64 ]; then
#echo "$PCTD"
ls -tr $FILE/arch*dbf | head -10 | while
read NAME
do
#echo "$NAME"
rm $NAME
done
fi
done
find $FILE -name "arch*dbf" -mtime +30 -type f -exec rm -rf {} \;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-2029576/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 5.Monitor filesystem usage & delete expire filedelete
- [Shell] monitor filesystem
- [Shell] Linux monitor tablespace usageLinux
- [Shell] monitor oracle alert.log file and sendmailOracleAI
- 3.linux monitor filesystemLinux
- 4.Linux monitor tablespace usageLinux
- How to Monitor UGA, PGA and Cursor Usage Per SessionSession
- Monitor RDBMS Session UGA and PGA Current And Maximum Usage Over TimeSession
- 轉淘寶流雲dbms_file_transfer package usagePackage
- [Shell] monitor cpu&mem收集資料
- [Shell] monitor oracle database listener & instance statusOracleDatabase
- [Shell] Linux monitor OS process and DB sessionLinuxSession
- 8.Monitor oracle alert.log file and sendmailOracleAI
- 【Mysql】為MySQL增加執行緒記憶體監控 (MySQL Thread Memory Usage Monitor)MySql執行緒記憶體thread
- [Shell] Monitor other host oracle instance alert.log and mailOracleAI
- 利用 File Monitor 對付隱藏目錄的加密光碟加密
- dnsjava usageDNSJava
- [Shell] awk學習(4)-read input file
- Oracle歸檔日誌使用情況: v$recovery_file_dest and v$recovery_area_usage.Oracle
- MIT6.828 La5 File system, Spawn and ShellMIT
- MIT-6.828-JOS-lab5:File system, Spawn and ShellMIT
- Unix Sed Tutorial: Delete File Lines Using Address and Patternsdelete
- PHP Filesystem 簡介PHP
- Shell重定向&>file、2>&1、1>&2的區別
- costume GIT usage for meGit
- solaris 10 disksuite usageUI
- table type usage sample:
- SQLNET.EXPIRE_TIME測試SQL
- Table Monitor
- [Oracle Script] Temporary Sort UsageOracle
- [Oracle Script] Rollback Segment UsageOracle
- BlockRecover Restrictions and Usage NotesBloCREST
- Clear Case usage tips
- Oracle runInstaller 's UsageOracle
- Oracle NUMA usage recommendationOracle
- MySQL, Incorrect usage of UNION and ORDER BYMySql
- Mount: you must specify the filesystem type
- 2788647047_monitor