Jump to content

Cronjob Database Backup


Recommended Posts

Hi, tks for the module.

I am triggering the db Backups using a script and a server cron job.

The code of the script is this

namespace Processwire;
require_once(__DIR__ . '/../../../index.php');
$cron_backup =$wire->modules->get('CronjobDatabaseBackup');

With this script the db backup file is created but when I access the db backup admin screen. I get these notifications (see screen shoot) and it seems that the db file cannot be read.

I checked the rights on the db files created this way but they are the same than the other backup files (created with the db backup module).

If I use the 'normal' lazy cron way with this module there is no problem.

Any idea ?
Tks a lot

Screenshot 2020-10-29 at 14.08.24.png

Link to comment
Share on other sites

  • 1 year later...

Hi. Great module, however found a small bug:

When trying to set "Backup name" in the module settings and using curly brackets "{}" to insert $user variables as per instructions - the field doesn't allow the curly brackets to be used. The validation pattern is missing them. Fixed for myself by adding to the module code temporarily at line 442.

  • Like 1
Link to comment
Share on other sites

@horst Sorry, I just disabled it all together for now ? I don't know how to correctly specify the pattern to include curlies, as the pattern syntax uses curly brackets itself ? It's best if someone more knowledgeable helps us both ?

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

I have a site where the database grew over 100Mb and the hosting implies a 120 seconds hard limit on mysql processing.
As a result, all scheduled backups trigger a PHP error:

Fatal Error: Maximum execution time of 120 seconds exceeded 
Line 854 of /wire/core/WireDatabaseBackup.php

Any suggestions?
The site has over 150k pages (orders and payments on top of content) and over 30k users and I need an hourly backup.
Because of the PHP error the Automatic Cleanup is not happening and, backups eventually filling up my hosting storage.
Can I reduce the database site? Or speed up the backup process? (Note: the server is quite fast).

Link to comment
Share on other sites

2 minutes ago, kixe said:

Increase your PHP maximum execution time:

Thanks, that doesn't work unfortunately, the hard limit applies specifically for database processing, according to hosting support. max_execution_time has no effect on it, it was already much higher. I wish it was that simple.

Link to comment
Share on other sites

1 hour ago, aagd said:

Are you on a shared hosting account? Wouldn't a server upgrade solve this? Or an external MySQL Hoster?

@aagd Yes, it's a shared hosting but upgrading is not an option at the moment.

Link to comment
Share on other sites


I have a lot of understanding for your problem, but it definitely has nothing to do with this thread (CronjobDatabaseBackup support). The error message you see is generated by a core class and is a result of the configuration of the server you are using. I recommend looking for a related thread or starting a new thread on this topic.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...