UnixServerAdmin

Server Administration & Management

Backup_rsync.sh

###########################################################
## backup_rsync.sh ##
###########################################################
## Make a Directory /REPORTS ##
## Make a file msg.txt under /REPORTS Directory ##
## Write Following in msg.txt file ##
###########################################################
## Hi, ##
## The Incremental Backup Report of server is attached with this mail. ##
## Thanks & Regards, ##
## Unixserveradmin.com Security Team ##
###########################################################
#! /bin/bash

/bin/echo “=================================================” > /REPORTS/Backup.log_$(date +%d%m%y)
/bin/echo “THE BACKUP IS STARTED AT $(date)” >> /REPORTS/Backup.log_$(date +%d%m%y)
/bin/echo “=================================================” >> /REPORTS/Backup.log_$(date +%d%m%y)
/bin/echo ”      ” >> /REPORTS/Backup.log_$(date +%d%m%y)
/bin/echo ”      ” >> /REPORTS/Backup.log_$(date +%d%m%y)
/bin/echo “=================================================” >> /REPORTS/Backup.log_$(date +%d%m%y)
/bin/echo “BACKUP LOGS ARE AS FOLLOWS:”  >> /REPORTS/Backup.log_$(date +%d%m%y)
/bin/echo “——————————————————–”  >> /REPORTS/Backup.log_$(date +%d%m%y)
########### Remote Sync between two directory ###########
#/usr/bin/rsync -avzE  /var/www/html/example/ root@X.X.X.X:/var/www/html/example/ >> /REPORTS/Backup.log_$(date +%d%m%y)
########### Remote Sync between two directory except config.php file ############
#/usr/bin/rsync -avzE –exclude config.php  /var/www/html/example/ root@X.X.X.X:/var/www/html/example/ >> /REPORTS/Backup.log_$(date +%d%m%y)
########### Remote Sync Two directory except config.php and *.txt files ###########
/usr/bin/rsync -avzE –exclude config.php –exclude ‘*.txt’  /var/www/html/example/ root@X.X.X.X:/var/www/html/example/ >> /REPORTS/Backup.log_$(date +%d%m%y)
#####################  #####################
/bin/echo “——————————————————–” >> /REPORTS/Backup.log_$(date +%d%m%y)
/bin/echo “=================================================” >> /REPORTS/Backup.log_$(date +%d%m%y)
/bin/echo “THE BACKUP HAS BEEN COMPLETED AT $(date)” >> /REPORTS/Backup.log_$(date +%d%m%y)
/bin/echo “=================================================” >> /REPORTS/Backup.log_$(date +%d%m%y)

mutt -s “REMOTE BACKUP REPORT $(hostname | tr ‘a-z’ ‘A-Z’)” -a /REPORTS/Backup.log_$(date +%d%m%y) unixserv@unixserveradmin.com < /REPORTS/msg.txt

mutt -s “REMOTE BACKUP REPORT $(hostname | tr ‘a-z’ ‘A-Z’)” -a /REPORTS/Backup.log_$(date +%d%m%y) info@unixserveradmin.com < /REPORTS/msg.txt

December 6, 2011 - Posted by | Shell Script, Tips & Tricks | , ,

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: