10: Tips and Tricks How to get the most out of your Dragonfly website i. Data BackupHow to easily backup your files and database.
i.a Fast thru PHP on Linux (doesn't work in safe_mode)
<?php
require_once('config.php');
set_time_limit(0);
header("Content-Type: application/x-gzip; name=\"$dbname.sql.gz\"");
header("Content-disposition: attachment; filename=$dbname.sql.gz");
passthru("mysqldump -f -h$dbhost -u$dbuname -p$dbpass $dbname --add-drop-table | gzip -9cf");
i.b CronJob/SSH
Create a file called mysqlbackup.sh
#! /bin/sh
DBNAME=here
DBUSER=root
DBPASS=fill_in
FILE1=${DBNAME}-`date +%Y%m%d%H%M`.sql
DIR=/home/YOURNAME/
mysqldump -f -hlocalhost -u${DBUSER} -p${DBPASS} --add-drop-table ${DBNAME} | gzip -9c >${DIR}${FILE1}.gz
|