Backup configure


#/bin/bash
mkdir /backup/$(date +%d-%m-%y)

zip -r /backup/$(date +%d-%m-%y)/$(date +%d-%m-%y).zip /home/user1 /home/user2  /home/user3

zip -r /backup/$(date +%d-%m-%y)/$(date +%d-%m-%y)_1.zip /home/user4 /home/user5 \
/home/user6 /home/user7  /home/user8  /home/user9

mysqldump -u user -pXXXXX –databases db1 db2  db3 db4 db5  db6 db7 db8 db9  > /backup/$(date +%d-%m-%y)/$(date +%d-%m-%y).sql

ncftpput -R -v -u user -p XXX (ftp server name  or ip)/daily /backup/$(date +%d-%m-%y)/

#———————-Mail Settings——————–#

# set to ‘y’ if you’d like to be emailed the backup (requires mutt)
MAIL=y

# email addresses to send backups to, separated by a space
SERVER=XXXServer
DATE=`date +’%d-%m-%y’`
EMAILS=”user@domain.com”
SUBJECT=”Directory Backup on $SERVER ($DATE)”
if  [ $MAIL = “y” ]
then
BODY=”Your Backup process completed.”

echo $BODY | mutt -s “$SUBJECT” $EMAILS

echo “Backup Completed”
fi

Configure to open files in vi editor default.
export VISUAL=vi

Advertisements
Published in: on April 10, 2010 at 1:45 am  Comments Off on Backup configure  
%d bloggers like this: