I don't use a module for this, so if that is exactly what you want, and the only way you want to perform this task. I can't help.
Here is a php script that will backup your MySQL database, creating a different file each day for a month (then start over) so you have 30 days of backups. It will email you with a backup confirmation. Run it every night using cron to kick it off. Replace the X's with your information. You should also download the backup files from the server on a regular basis.
<?php
$emailaddress = "XXXXXX@yourdomain.com";
$host="XXXXXX"; // database host
$dbuser="XXXXXX"; // database user name
$dbpswd="XXXXXX"; // database password
$mysqldb="XXXXXX"; // name of database
$path = "/full_server_path_to_file_goes_here"; // full server path to the directory where you want the backup files (no trailing slash)
// modify the above values to fit your environment
$filename = $path . "/backup" . date("d") . ".sql";
if ( file_exists($filename) ) unlink($filename);
system("mysqldump --user=$dbuser --password=$dbpswd --host=$host $mysqldb > $filename",$result);
$size = filesize($filename);
switch ($size) {
case ($size>=1048576): $size = round($size/1048576) . " MB"; break;
case ($size>=1024): $size = round($size/1024) . " KB"; break;
default: $size = $size . " bytes"; break;
}
$message = "The database backup for " . $mysqldb . " has been run.\n\n";
$message .= "The return code was: " . $result . "\n\n";
$message .= "The file path is: " . $filename . "\n\n";
$message .= "Size of the backup: " . $size . "\n\n";
$message .= "Server time of the backup: " . date(" F d h:ia") . "\n\n";
mail($emailaddress, "Database Backup Message" , $message, "From: Website <>");
?>
- - End Script Here - -
You can backup all the databases for your user in one backup using the following line in the above script:
your mileage on the above code may vary. It was written & works on site5 servers.
_____________________________________________________________________ My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )
It integrates with http://drupal.org/project/workflow_ng which you can use to send the email. However, I don't think you can actually send the file in the email, just a link to it.
entirely using php so it should run on any platform.
It -
runs at specified intervals (needs cron).
saves backup files in the files folder
will delete old backup files after specified interval (needs cron)
Will optionally email the file as an attachment
will use gz compression if it is available
has options for drop table etc
has option to omit specified tables such as session, watchdog
can run on demand which presents an immediate file download dialog
If someone posting on this thread (or other interested bystander!) would like to mentor me to getting it to be a contributed module, I would be happy to do this. I have used it on several sites for about a year and it seems to work, but a more experienced drupaller would be able to advise on improving it I am sure. PM me if you would like to try it or do the mentoring. My local machine is windoze and remote hosts are *nix.
Comments
=-=
I don't use a module for this, so if that is exactly what you want, and the only way you want to perform this task. I can't help.
Here is a php script that will backup your MySQL database, creating a different file each day for a month (then start over) so you have 30 days of backups. It will email you with a backup confirmation. Run it every night using cron to kick it off. Replace the X's with your information. You should also download the backup files from the server on a regular basis.
You can backup all the databases for your user in one backup using the following line in the above script:
system( "mysqldump --all-databases --user=$dbuser --password=$dbpswd --host=$host > $filename",$result);You can restore a database using the following line in a php script:
system( "mysqldump --user=$dbuser --password=$dbpswd --host=$host $mysqldb < $filename",$result);Note that hosts may have different paths for the mysql commands. For example /usr/local/bin/mysqldump could be required.
If you want the backup file to be compressed, then change two lines (the $filename variable and the system() command) as follows:
your mileage on the above code may vary. It was written & works on site5 servers.
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )
Try Backup and Migrate
Located here: http://drupal.org/project/backup_migrate
It integrates with http://drupal.org/project/workflow_ng which you can use to send the email. However, I don't think you can actually send the file in the email, just a link to it.
txcrew
--------
http://3to1studios.com
How different is that to the
How different is that to the backup module (http://drupal.org/project/backup)?
And why do we have two, anyway?
Cron backups
Cron supported backups and workflow-ng integration. The backup.module does not have this at core level.
txcrew
--------
http://3to1studios.com
I wrote myown
entirely using php so it should run on any platform.
It -
If someone posting on this thread (or other interested bystander!) would like to mentor me to getting it to be a contributed module, I would be happy to do this. I have used it on several sites for about a year and it seems to work, but a more experienced drupaller would be able to advise on improving it I am sure. PM me if you would like to try it or do the mentoring. My local machine is windoze and remote hosts are *nix.
Paul
www.purpleoar.co.nz/scryptik - Javascript editor with syntax error checking
www.purpleoar.co.nz - Web development, Drupal consultancy
www.purpleoar.co.nz/scryptik - Javascript editor with syntax error checking
www.purpleoar.co.nz - Web development, Drupal consultancy
@ scrypter That sounds like
@ scrypter
That sounds like a GREAT module! But alas, I cannot help you with the further development as I'm not really a coder.
Perhaps you should merge your efforts with the http://drupal.org/project/backup_migrate so we can have a more feature rich module instead of yet another backup module. Most of the feature your script offers are feature requests in the issue queue for that mod: http://drupal.org/project/issues/backup_migrate?categories=feature. Perhaps you could roll some patches against the backup_migrate project?
Just my two cents.
txcrew
--------
http://3to1studios.com
are there other solutions?
are there other solutions? backup and migrate module and backup module is not suitable for drupal 6x