UnixServerAdmin

Server Administration & Management

Backup_script.sh

###################################################################
# Application Server Backup ##############################################
# backup_script.sh script #################################################
###################################################################
#!/bin/sh
set -x
set -v
standby=$1
myfile=”`date ‘+%d-%b-%Y-%H-%M’`.tar.bz2″
BACKUPDIR=/backup/htmldaily/
BACKUPFILE=`date ‘+%d-%b-%Y-%H-%M’`.tar
cd $BACKUPDIR
tar cvf $BACKUPFILE /var/www/html/
bzip2 $BACKUPFILE
cd /backup/htmldaily/

scp /backup/htmldaily/$myfile backup@$standby:/backup/autobackup/htmldaily/
scp /backup/htmldaily/$myfile backup@X.X.X.X:/backup/autobackup/htmldaily/
###################################################################

Advertisements

January 9, 2012 - Posted by | 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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: