1. Go to drive.google.com and get a new account. You don't have to give a phone 
number, just a birthdate. Write down the password and keep it in a safe place. 
If you already have a Google account which you don't want to use and you are 
logged in with Firefox, simply use IE or Chrome.

2. Enter these commands as root: 
[code]# apt-get install grive
# mkdir /backup /backup/mysql /backup/google
# cd /backup/google; give -a[/code]
Now grive will display an URL. Enter the URL into your browser and follow 
instructions. Enter the verification code from the web page into the running 
grive -a command. Done. Now your /backup/google directory is synchronized with 
Google Drive.

3. Generate a key file for encryption. Keep it in a safe place (not only on the 
server!). 
[code]# openssl rand 128 >> /backup/key.bin[/code]

4. Copy the following script into /backup/run.sh and change the MySQL password:
[code]#!/bin/sh
DST=/backup/mysql
GOO=/backup/google
DBUSER=root
DBPASS=YOUR_MYSQL_PASSWORD_GOES_HERE
KEEPDAYS=7
DATE=$(date +%Y-%m-%d)
find ${DST} -type f -mtime +${KEEPDAYS} -name \*sql\* -exec rm -f {} \;
find ${GOO} -type f -mtime +${KEEPDAYS} -name \*bin -exec rm -f {} \;
db=magnolia_author
out=${DST}/${db}.${DATE}.sql
enc=${GOO}/${db}.${DATE}.bin
echo "dumping"
mysqldump --opt -c -e -u ${DBUSER} -p${DBPASS} $db > $out
echo "zipping"
gzip -f $out
echo "encrypting"
openssl aes-256-cbc -in ${out}.gz -out $enc -pass file:/backup/key.bin
#db=magnolia_public
#out=${DST}/${db}.${DATE}.sql
#enc=${GOO}/${db}.${DATE}.bin
#echo "dumping"
#mysqldump --opt -c -e -u ${DBUSER} -p${DBPASS} $db > $out
#echo "zipping"
#gzip -f $out
#echo "encrypting"
#openssl aes-256-cbc -in ${out}.gz -out $enc -pass file:/backup/key.bin
echo "grive"
cd $GOO
/usr/bin/grive
echo "done"[/code]

5. Add the following line to /etc/crontab
[code]11 2   * * *   root /backup/run.sh > /var/log/backup.log 2>> 
/var/log/backup.log[/code]

6. To restore, you decode the backup file with [code]openssl -d[/code]. Then 
use [code]mysql -u root -p magnolia_author < filename[/code]

Cheers,
Roland (freelancer, Munich)

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=2292fa3b-4fbf-4a3d-999f-122037db0f09


----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to