Back in 08ish I wrote a Perl script that not only backed up the database but also the physical files. I ran it via CRON but it could also be manually envoked. You can use the single line in the code below noting the mysqldump as Paul mentioned. The code below will give you an idea of what you need to read about (mysqldump switches) to get a proper backup.
#!/usr/bin/perl
# System Backup
#------ Variables ------
$backupdir = "/usr/local/DirectoryOfBackUpLocation"; # "." for current
$other_dirs = "/usr/local/DirectoryToBeBackedUp1 /usr/local/DirectoryToBeBackedUp2";
#-----------------------
print "Backup Initiated...\n";
@timenow = localtime(time);
$newfilename = sprintf("%02d",$timenow[4]+1) .
sprintf("%02d",$timenow[3]) . ($timenow[5] + 1900);
print "Using Filename: $newfilename.sql \n";
print "Starting database backup... \n";
system "mysqldump -qce -r $newfilename.sql -u root DataBaseName";
print "Starting Compression... \n";
system "tar czf $backupdir/$newfilename.tar.gz $other_dirs $newfilename.sql";
unlink "$newfilename.sql" || print "Error: Cannot delete file specified: $newfilename - $_ \n";
print "Done. \n"
I use Paul's modification on ALL my sites and am surprised it is not a default VB option. As backups are critical if you run a site.
If I had any requests it would be to have an option to also include the physical files and auto purge backups X days old.
|