将多个unix命令的输出存储到文件并邮寄

时间:2017-01-26 23:06:13

标签: linux shell

我试图将以下命令的输出存储到文件中。每次我执行此操作时都会卡住。

 cat >/u01/app/orcpprod/hccdba/bkpchklog.log <<EOL
echo " "
date;
echo "====================="
echo "DATABASE BACKUP CHECK"
echo "====================="

#RMAN Backup in Progress
echo "RMAN Process Info"
ps -ef|grep rman


#Error in alert log
echo "Check the error count "
tail -30 /var/opt/oracle/backups/CPPROD/BACKUP_CPPROD.log


#Displays the errors if they are present
echo "Errors if any"
egrep "RMAN-|ORA-|Error|ERROR|^cp|^gzip|^tar" /var/opt/oracle/backups/CPPROD/BACKUP_CPPROD.log


#Backup Start Time
echo "Backup Start Time"
head -1 /var/opt/oracle/backups/CPPROD/BACKUP_CPPROD.log

#Backup End Time
echo "Backup End Time"
tail -n 19 /var/opt/oracle/backups/CPPROD/BACKUP_CPPROD.log| grep -i Finished

#Size of the backup
echo "Backup Size"
cd /u02/backup/rman_bkp_wkly/CPPROD/day1
du -sk rman_data* | awk '{ sum += $1} END {print sum/1024 "M"}'

EOL

#Mail info
mail -s /u01/app/orcpprod/hccdba/bkpchklog.log "$ORACLE_SID :: Backup Check Info" deepak.goel@hitachiconsulting.com

0 个答案:

没有答案