UnixServerAdmin

Server Administration & Management

backup_script_encrypt.sh (in tar.gz format)

#########################################################################
# Application Server Backup #######################################################
# backup_script_encrypt.sh (in-bzip2-format script) #########################################
#########################################################################
#!/bin/sh
set -x
set -v
standby=$1
myfile=”Test_Backup`date ‘+%d-%b-%Y-%H-%M’`.tar.gz”
BACKUPDIR=/backup/htmldaily/
BACKUPFILE=”Test_Backup`date ‘+%d-%b-%Y-%H-%M’`.tar”
cd $BACKUPDIR

tar cvf $BACKUPFILE /var/www/html/
tar -zcvf – $BACKUPFILE | openssl enc -aes-256-cbc -pass pass:ABCabc123@  -e | dd of=/backup/htmldaily/$myfile.enc
rm -rvdf $BACKUPFILE

scp /backup/htmldaily/$myfile backup@$standby:/backup/autobackup/htmldaily/
rsync -avzE –progress /backup/htmldaily/$myfile backup@X.X.X.X:/backup/autobackup/htmldaily/
#########################################################################
# To decrypt Test_Backup.bzip2 file
#
# openssl  aes-256-cbc  -d  -pass pass:ABCabc123@  -in  Test_Backup.tar.gz.enc  -out  Test_Backup.tar.gz
#########################################################################
# -d –decompress
# -c –create
# -f –force
# -v –verbose
# -z –gzip
# Password = ABCabc123@
#########################################################################

Advertisements

March 13, 2013 - Posted by | Security, Shell Script | ,

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: