UnixServerAdmin

Server Administration & Management

report-backup.sh

#############################################################
## report-backup.sh ##
#############################################################
## Script for Daily Backup Report of Servers ##
#############################################################
## Make a Directory /REPORTS ##
## Make a file msg.txt under /REPORTS Directory ##
## Write Folowing in msg.txt file ##
#############################################################
## Hi, ##
## The Daily Backup of All Servers have Done. ##
## The Daily Backup Report is attached with this mail. ##
## Thanks & Regards, ##
## Unixserveradmin.com Security Team ##
#############################################################
#!/bin/sh
set -x
set -v
standby=$1
BACKUPDIR=/datasrv/
BACKFILE1=`date ‘+%d-%b-%Y-‘`
BACKFILE2=`date –date=’yesterday’ ‘+%d-%b-%Y-‘`

/bin/echo ”      ” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo “====================================” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo “Daily Remote Backup Report of the Project on Today” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo “====================================” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo ”      ” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/usr/bin/du -hs /datasrv/*/*$BACKFILE1* >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo ”      ” >> /REPORTS/Backup.log_$(date +%d%m%y).txt

/bin/echo ”      ” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo “====================================” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo “Daily Remote Backup Report of UPSRTC Project on Yesterday” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo “====================================” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo ”      ” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/usr/bin/du -hs /datasrv/*/*$BACKFILE2* >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo ”      ” >> /REPORTS/Backup.log_$(date +%d%m%y).txt
/bin/echo “====================================” >> /REPORTS/Backup.log_$(date +%d%m%y).txt

mutt -s “Daily Remote Backup Report of the Project” -a /REPORTS/Backup.log_$(date +%d%m%y).txt — unixserv@unixserveradmin.com  info@unixserveradmin.com  < /REPORTS/msg.txt
###################################################################

February 20, 2014 Posted by | Shell Script | | Leave a comment