Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: supahben on December 19, 2009, 02:16:04 PM

Title: Save your backups to an external server automatically
Post by: supahben on December 19, 2009, 02:16:04 PM
Based from the guide I found here (http://www.simplemachines.org/community/index.php?topic=45856.0) (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
Title: Re: Save your backups to an external server automatically
Post by: Ash-1993 on December 19, 2009, 02:25:02 PM
Try and ask your host. They can make database backup daily.
Title: Re: Save your backups to an external server automatically
Post by: supahben on December 20, 2009, 01:22:13 PM
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..