Save your backups to an external server automatically

Started by supahben, December 19, 2009, 02:16:04 PM

Previous topic - Next topic

supahben

Based from the guide I found here (check this first), I just thought of these extra modifications to be able to save it to an external server (send as email) like an email provider with unlimited storage space.

Here's what I did with daily.sh
#! /bin/sh
DATESTAMP=`date +%m-%d-%Y-%H%M`
cd /home/username/backups/database/
mysqldump --opt -pPASSWORD -uUSERNAME DATABASE | gzip >$DATESTAMP.gz
uuencode $DATESTAMP.gz $DATESTAMP.gz | mail [email protected]
find /home/username/backups/database -type f -mtime +2 | xargs rm -f


most of the email providers dont understand uuencode being an attachment.. what i use is indiatimes.com's service.. i also use sify.com on other sites.

the last line also deletes backups that are 2 days old or more

A BIG NOTE: Don't ever try to edit the script to make it save the gzips to the home folder because as ive said, it will delete files that are 2 days old or more.. Make yourself a separate backups/database folder for extra caution

Ash-1993

Try and ask your host. They can make database backup daily.
Need Any Support With Your SMF 1.X And SMF 2.X? If So Then Im Here To Help Send Me A [PM] And I Will Get Too You As Soon As Possible.

- Ash-1993

supahben

Quote from: Ash-1993 on December 19, 2009, 02:25:02 PM
Try and ask your host. They can make database backup daily.
this is supposed to be a guide, sorry..

anyway for those who want to try it, please read the guide I based this tip first because i am expecting you to do that first..

Advertisement: