orale 备份脚本 #!/bin/bash #/hoMe/oracle/.bash_profile backup_data=`date +%Y%m%d` back_home=/home backup_dest=/home/oracle/back_data backup_log=/home/oracle/back_log RECIPT='xuezm@***.com' #check disk free space USED=`df -h | grep 446 | awk '{print $4}' | awk -F% '{print $1}'` if [ $USED -gt 85 ];then echo "Disk space is full/243/254please check it"|mail -s "oracle(192.168.*.*) full backup failed" $RECIPT exit fi #start backup exp system/abc123 full=y buffer=65536 file=$backup_dest/data.$backup_data.dmp log=$backup_log/log.$backup_data.log #delect old file list=`find /home/oracle/back_data/ -mtime +7` echo $list rm -f $list if [ $? -ne 0 ]; then cat $backup_log/log.$backup_data.log|mail -s "oracle(192.168.*.*) full backup failed,please check it" $RECIPT exit 1 fi cat $backup_log/log.$backup_data.log|mail -s "$backup_date exp log " $RECIPT #其中USED=`df -h | grep 446 | awk '{print $4}' | awk -F% '{print $1}'` 中,446 是指系统硬盘的大小 会提示输入用户名和密码