2
votes

Does anybody have any idea on the best way to automate the process of creating regular file backups of the whole Drupal installation, and also the mySQL databases.

I've used the 'Backup and migrate' module, which is great, but this only backs up the database for Drupal 7. The Backup and migrate files isn't yet built for D7.

1

1 Answers

2
votes

hook_cron can be helpful in this regard

function mymodule_cron(){
   global $db_url;
   $db_info = parse_url($db_url);
   exec("mysqldump -u$db_info[user] -p$db_info[pass] " . substr($db_info[path],1) . " > /path/to/backup/folder/file.sql");
   exec("tar -czf /path/to/backup/filename.tar.gz /path/to/webroot");
}

Then you can configure /path/to/webroot/cron.php script with your crontab to make this system automate.

For all this you will have to create a custom module