Add-on Backup Entire XenForo Install + Database To Amazon S3

Been working on this: http://xenforo.com/community/threads/a-r-f-i-a-really-fast-vb4-importer-paid.43779/page-2 so havent realy had time.


What you'll need to do though (ive added comments to help)

Get https://github.com/MoriTanosuke/glacieruploader

Make a cron job to run the script below every day / week etc as needed.

Code:
#!/bin/bash
#Example Backup Script to upload website to Amazon Glacier by Slavik at XenForo.com
#May be re-distributed if above credits left entact
 
suffix=$(date +%w%a)
 
rm -Rf /var/backup/* #remove all files in the backup directory
 
sleep 5 #waits 5 seconds, if you do a HUGE backup of a lot of files, increase as needed
 
mysqldump -h localhost -uusername -ppassword databasename > /var/backup/database.sql #dump your database, copy this as many times as needed
 
sleep 10m #waits 10minutes while you database dump happens, alter as needed for your database size
 
cp -R /location/to/files /var/backup/files #copies all files from your main directory eg httpdocs to the backup directory, copy as many times as needed
 
sleep 30 #waits 30 seconds for the files to copy, alter as needed
 
tar -cvf /var/$suffix.tar /var/backup/* #tars everything into a file with permissions etc entact
 
sleep 30 #waits 30 seconds for everything to get zipped up, alter as needed
 
mv /var/$suffix.tar /var/backup
 
sleep 1 #wait for a second
 
java -jar /var/glacieruploader.jar --endpoint https://glacier.eu-west-1.amazonaws.com --vault vaultname --upload /var/backup/$suffix.tar


Why do you need the sleep command? Wouldn't the script execute each statement sequentially and start teh next command only after the previous one was completed?
 
Top Bottom