Hourly DB Backup Option Not Consistently Working

Home Forums BulletProof Security Pro Hourly DB Backup Option Not Consistently Working

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #40888
    Living Miracles
    Participant

    Hello,

    I’ve been testing out a scheduled DB backup job set to hourly on one of my sites and I noticed it was not working for some reason. It would only do the first backup and then wouldn’t do any others. I noticed that when I originally tested this a few months ago, there were many repeating errors in the PHP Error Log. However, when I would set the schedule to daily instead, that would work.

    As part of troubleshooting this issue, I just created a brand new WordPress site on the server yesterday and then just added the BulletProof Security Pro plugin to it and initially just configured an hourly DB backup job on it with the “Delete Backup Files Older Than 1 Day” setting. It worked well for the first three hours but then started to skip certain hours for some reason. Now, after more than 24 hours of it running, there are only the following six DB backup .zip files in the backup folder currently:

    • 2021-11-07-time-11-05-31-pm.zip
    • 2021-11-08-time-1-02-27-am.zip
    • 2021-11-08-time-10-50-56-pm.zip
    • 2021-11-08-time-12-10-33-pm.zip
    • 2021-11-08-time-4-53-44-am.zip
    • 2021-11-08-time-6-08-28-pm.zip

    From what I understand, I should have 23–24 DB backup .zip files in the backup folder at any one time after the first 24 hours of it running and there should be a backup from basically every hour. So I wanted to report this issue to you to see if this is something that needs to be fixed from your end. If you’re confident that this isn’t an issue from your end, then do you have any idea what could be causing this issue from my end, especially since I tested this on a brand new site?

    Thank you.

    #40892
    AITpro Admin
    Keymaster

    I assume you were just testing hourly DB Backups to test them and do not really want to do a DB Backup every hour?  WordPress crons require that your site is visited (pinged) at least once during a cron interval in order for the next cron job to fire at the next scheduled interval.  Example:  If your site does not get a visit (ping) during a particular hour then the next scheduled cron would not fire at that hourly interval.  BPS works with Direct cron jobs that you can setup in your web host control panel.  What you can do is set a basic Direct cron job to visit (ping) your wp-cron.php file every x minutes, but if you were just testing hourly DB Backups for testing purposes and want to setup a more realistic DB Backup time of once per day then you would not need to bother with setting up a Direct Cron job.

    Important Note:  The way the AutoRestore|Quarantine cron works is that if your site is being attacked then the ARQ cron interval fires immediately.  The attack itself triggers the standard WP crons.  Worth mentioning.  😉

    #42011
    Living Miracles
    Participant

    Hello,

    Thanks for your response at the time! That’s helpful to know how this feature and ARQ work with WordPress crons.

    We were testing the hourly DB backups as this feels like it could be a handy feature for our popular membership site. We realized at some point that if something unfortunate happened to the site and we needed to recover from it with a backup, our daily backups wouldn’t suffice. There is so much happening on the site involving memberships and many new members every day that many database changes occur throughout the day, and we would lose a lot of that without more frequent database backups.

    I have recently had a chance to start testing this out again, and I have found that on a couple of very simple WordPress sites using server/direct cron jobs that run every 5 minutes, it’s still not creating a DB backup .zip file on each site every hour. Also, there aren’t a total of 23–24 DB backup .zip files in the backup folder of each site either as I would expect there to be if this were working correctly from what I understand. Those two sites instead have 17–18 DB backup .zip files in their backup folders. In addition, I am noticing that on both sites, this tool seems to skip one of the hourly backup intervals randomly for some reason every so often (ranging so far from every other hour there is a skip to it working for 7 hours in a row).

    Do you know how we can get this to work so that we consistently have a DB backup .zip file generated every hour and have a total of 23–24 of these files at all times on a site?

    Thank you!

    #42012
    AITpro Admin
    Keymaster

    You can try changing your Direct Cron job to 1 minute intervals instead of 5 minute intervals.  IMO there is only 1 correct interval setting for a Direct Cron job and that is 1 minute.  Let me know if that works or not.  If that does not work then you would probably want to look into some type of server-side backup solution that does not rely on Crons.

    #42026
    Living Miracles
    Participant

    Hello,

    Thank you for the recommendation to try changing the Direct Cron Job from five-minute intervals to one-minute intervals for this testing. I’ve been testing this out on some of our sites for the past couple of weeks. The following are basic results I’ve noticed from checking on the backups folder on each site every so often during that time:

    • On a brand new temporary site on our server with only the BPS Pro plugin activated:
      • Direct Cron Job with one-minute intervals: 17–18 DB backup .zip files
    • On a couple of our very simple and small sites:
      • Direct Cron Job with one-minute intervals: 18–20 files DB backup .zip files
        • For some reason, one of the sites only had 15 DB backup .zip files one of the times I checked. Might have just been a temporary issue.
      • Direct Cron Job with five-minute intervals: 15–18 DB backup .zip files
    • On our popular and large membership site:
      • Direct Cron Job with one-minute or two-minute or five-minute intervals: 12–13 DB backup .zip files (for some reason consistently skipping every odd-numbered hour)

    Does any of this data make sense to you or indicate where the issue could lie that’s preventing this from consistently generating a DB backup .zip file every hour and us having a total of 23–24 of these files at all times on any of our sites, especially for our popular membership site?

    #42028
    AITpro Admin
    Keymaster

    The DB Backup jobs are scheduled cron jobs.  Cron jobs will always fluctuate and are not going to be exact. Also various other factors can affect cron jobs besides just visitor traffic to your website.  If you want backups done at a specific time then what you are looking for is something that does backups based on your web server’s internal time/clock and not anything that does backups via cron jobs.  Most web hosts offer backup services in the Control Panel these days.

    #42035
    Living Miracles
    Participant

    Thanks for the information. Since there isn’t a way through the BPS Pro plugin itself to consistently generate a DB backup .zip file every hour on any of our sites, we’ll keep that in mind then.

    #42036
    AITpro Admin
    Keymaster

    Yep, that is a standard limitation of Cron jobs.  The only way to have something run at an exact specific time is to run it based on your host server’s internal time/clock.  And you also need to run that backup from the server, not your website.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.