Is there some sort of addon for phpnuke that will automatically backup your site's SQL database every day or so?
If not, could someone tell me how I could go about making one, it should backup even the tables that were customly created for other modules/addons. It would be useful if it could send the generated SQL file to a remote FTP server or something, just in case the site gets hacked.
Actually after further research, you can get mysqldump to directly write the backup file to another host. I have never used this myself, but you can try and let me know if it works.
So all you need is one mysqldump command saved in crontab, and you should be good to go. The only thing is that the backup file will be overwritten. There are other tricks to make the file name unique (e.g. timestamp in name, etc.) but that gets a bit more complex.. but if you use a php script to do a system call to mysqldump, you can easily accomplish stuff like that as well.
Ok, i wasn't able to get the -h part working. I looked around and it seems like it requires the remote server to have a database of its own. i just wanted to transfer the files over, so I'll try using FTP unless someone can clear up a misconception or knows a better way. I think i can get the cron job working if i just read a little more. Thanks a lot!
this is what i made for backing it up:
Code:
<?php
/*
MySQL Database Backup Script
by zoid
1. Place this file in a world-writeable (CHMOD 777) directory.
2. Fill out the marked config variables (from $format to $database) below.
3. Run the file (go to www.your_site.com/your_dir/autosqlbackup.php) and
follow the errors. You may re-run the script to see if any of the errors were fixed.
Do whatever it may tell you to do.
If you setup the script correctly from the start, it should only give you errors the first time you run it.
*/
echo "<html><head><title>MySQL Database Backup Script</title><META NAME=\"generator\" CONTENT=\"MySQL Database Backup Script by zoid\"></head><body>";
// ***CONFIGURATION - EDIT THE BELOW LINES***
$format = "sql"; // The format to save your backups with, "sql" or "gzip"; gzip has smaller filesize & takes up less space
$path = "backup/"; // Directory to save backups to
$prefix = "backup_"; // Prefix for all backup files generated
$extsql = ".sql"; // Extension used when saving as an uncompressed sql file
$extgz = ".gz"; // Extension used when saving as a gzip compressed file
$username = ""; // Username for the SQL Database
$password = ""; // Password for the SQL Database
$database = ""; // SQL Database Name
// ***CONFIGURATION - EDIT THE ABOVE LINES***
if ( $username == "" || $database == "" ) {
echo "<font color=\"#FF0000\"><b>You did not completely modify the configuration for this script.<br>Re-edit the configuration section of this file.</b><br><br>It was found that you left the \$username and/or \$database values empty.</font><br>";
};
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum