DB Backup Scheduler

https://www.phpbb.com/ideas/
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 5871
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: DB Backup Scheduler

Post by thecoalman »

Ger wrote: Fri Feb 16, 2018 1:43 pm Doesn't every descent host offer DB backups in the control panel? I can go back 7 days, that would suffice I'd say.
Unless you have control over when they are made and can download them as they are made I would not rely on that. I have a VPS and the server died once, when the server came back online the database backup they restored was three days older than when the server failed as was everything else. e.g. log files were missing 3 days and as another example files that been uploaded were missing. I had my own backups so it was no big deal.

Another hard lesson to avoid is the importance of having revisions. e.g. you accidentally set a forum to prune posts and never realize it for a lengthy period of time. If your oldest backup is after it was pruned you are toast.

The script I linked to above by default will make a daily backup for say Mon to Sat. It will delete the the backup from last Monday when a new week starts. On Sun. it will create a weekly backup in different folder, those are rotated out after 5 weeks. It also creates monthly backup, by default those are rotated out every 6 months but I keep them all.

In other words i have backup for each of the last 7 days, I have backup for each of the last 5 Sundays and I have a backup for the first of each month going back years.

That is jut the tip of the iceberg for that script. It does incremental backups, will encrypt the backup, email backups and i thin it will even upload them to offsite service etc. I have my FTP client scheduled to download them.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26505
Joined: Fri Aug 29, 2008 9:49 am

Re: DB Backup Scheduler

Post by Mick »

Mick wrote: Mon Feb 12, 2018 10:37 amYou can backup the DB as much as you like . . .
But does it check them?
  • "The more connected we get the more alone we become" - Kyle Broflovski©
  • "The good news is hell is just the product of a morbid human imagination.
    The bad news is, whatever humans can imagine, they can usually create.
    " - Harmony Cobel
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 5871
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: DB Backup Scheduler

Post by thecoalman »

Mick wrote: Fri Feb 16, 2018 7:04 pm But does it check them?
Are you asking me Mick? This is a bash script and commands are issued directly to MySQL, time out issues associated with PHP which is apparently the biggest issue for most people do not exist. My understanding is the possibility of this failing is slim, you would need a preexisting problem such as a crashed table, MySQL itself crashed etc..

It will email you copy of the log. Additionally I check the file sizes occasionally for consistency, they grow X amount of KB's per day under normal operation. About once a month the most recent backup is used to populate a database on my local machine.

Getting back to the topic at hand, as far as the PHP timeout issue for support questions if I suspect it might be incomplete database backup I always ask people to open the file and see if the last insert commands are for phpbb_zebra. Perhaps if a comment line was added like #end phpBBbackup you could then have cron.php grab the last line of the last backup to check for that line.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26505
Joined: Fri Aug 29, 2008 9:49 am

Re: DB Backup Scheduler

Post by Mick »

thecoalman wrote: Fri Feb 16, 2018 11:02 pmthe last insert commands are for phpbb_zebra. Perhaps if a comment line was added like #end phpBBbackup you could then have cron.php grab the last line of the last backup to check for that line
Now we’re talking!!
  • "The more connected we get the more alone we become" - Kyle Broflovski©
  • "The good news is hell is just the product of a morbid human imagination.
    The bad news is, whatever humans can imagine, they can usually create.
    " - Harmony Cobel
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: DB Backup Scheduler

Post by david63 »

Mick wrote: Sat Feb 17, 2018 10:30 am
thecoalman wrote: Fri Feb 16, 2018 11:02 pmthe last insert commands are for phpbb_zebra. Perhaps if a comment line was added like #end phpBBbackup you could then have cron.php grab the last line of the last backup to check for that line
Now we’re talking!!
But what would happen if an extension added another table after _zebra (unlikely I know but possible)?
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
User avatar
canonknipser
Registered User
Posts: 2096
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs
Contact:

Re: DB Backup Scheduler

Post by canonknipser »

The #end-comment or similar would be save, I think - even for the worst case that tables are listed in the backup in another order - maybe in creation time order, so that extension tables or tables added by later releases will go to the end.

It's a very common praxis to have a start an a end line in files (and often the end line also contains control elements like sums or line counters) so the file can be checked to be complete.
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB
Post Reply

Return to “phpBB Ideas”