Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * * * 1 votes

Contribution: Auto Backup Database


159 replies to this topic

#121 mafiouso

  • Community Member
  • 141 posts
  • Real Name:mafiouso

Posted 10 June 2010, 06:12

i installed this. ran the php file. it says all is ok
but there are no back files being made

any idea? thanks

#122 32 Degrees

  • Community Member
  • 218 posts
  • Real Name:Ryan
  • Gender:Male
  • Location:California, USA

Posted 25 August 2010, 03:10

Spooks,

I'm just not understanding the configuration settings. My goal is to have the modification automatically make a backup at a specific time every day. I set the cron job up to do that. I would prefer the modification not to backup any other time then when the cron executes. Would you be so kind and tell me the settings I should have set. Also I want it keep the last 31 days of backups.

I appreciate your help.

Ryan
[IMG]http://img263.imageshack.us/img263/4146/plasma.jpg[/IMG]

#123 Peter M

  • Community Member
  • 52 posts
  • Real Name:Peter Milner
  • Gender:Male
  • Location:South West UK

Posted 05 December 2010, 01:43

I would just like to say here that I have implimented this contribution with great success (once I got my head round how it works)so very well done to the author of this great contribution!

One thing I did notice was that as auto_backup_db.php doesn't include the applicaiton_top.php. I found that the date and time being used to generate the file name wasnt the same as when the database manager was saying the back up was made. Having made a small modification to auto_backup_db.php solved that problem.

The way I use it is as follows;

I have a windows sbs 2003 server which has all the day to day office functions on it including exhcange, general file sharing and accounting systems data etc. On this server I am making use of the job scheduler, so I wanted to keep all my backups and other processes in one place (mostly for ease of admin) so I found a way of being able to call and run a remote php from the server, after much research I found the best way was to use a little command line ftp utility called Wget.

What I then did was to set the 2 parameters in the auto backup admin to time interval of 30 minutes and archive interval of 1 1/2 hours. I then scheduled a job in the sheduler on the local server to run auto_backup_db.php every 2 hours, this process starts at 02:00 every morning and does the last one at 22:00. This generates 11 backups at 2 hour intervals over a 22 hour period.

My main backup batch script runs at 23:45 every night, (only to keep the dates correct for the day) this calls auto_backup_db.php agian to make the 12th backup .sql file, then it generates new folders by date in the external data backups folder on the raid 5 array and using Wget again downloads the .sql files for the day to a database backup folder and then the entire content of the site to a system folder (excluding the .sql files).

This process also backs up 2 other static websites in the same way, then providing the .sql files were downloaded successfully, deletes them from the remote server. Unfortunately Wget doesn't support delete remote files, so I had to resort to building a conventional command line ftp script from within the main backup batch script that does an mdelete of the .sql files by date for that days files only.

Once this process is complete, it then does a backup to tape of all data on the raid array using good old NTBackup. The good thing is this is a totally automomous process, the only user intervention requird is to remember to put a tape in the drive!

I think this is about as complete a backup process as one could hope for, it certainly gives me confidence in knowing I could if necessary recover from just about any situation including a full rebuild with a copy of the database which is no more than 2 hours old at most. Of course these timings could be changed to suit any purpose, but 2 hours is fine for my needs.

#124 Zachary

  • Community Member
  • 28 posts
  • Real Name:Zachary
  • Gender:Male
  • Location:Scottsdale, Arizona

Posted 23 December 2010, 04:14

Ok I have a strange thing happening. Its not a error but once I installed this cool contribution, I started browsing around to make sure it didn't break anything with the admin side of the site.

I found that before I added this. The "module" part of the admin site would come up and state "Payment module". But after install this one it now reads "Database Backup Manager".

This is my first addon for this fresh clean install.

I am running
osCommerce Online Merchant v2.2 RC2a

Server OS: Linux 2.6.18-164.15.1.el5PAE
Database: MySQL 5.0.91-log
PHP PHP Version 5.2.14

Any thought on why this happened. Other than this little mix up the addon works wonderfully.

#125 francois21

  • Community Member
  • 68 posts
  • Real Name:francois
  • Gender:Male
  • Location:France

Posted 09 January 2011, 21:34

Hi
thank's for that great addon.
all is good but I have the same problem than Zachary.
is there an issue for .

Thank's
Excuse my bad english!

francois

#126 here2learn

  • Community Member
  • 37 posts
  • Real Name:Matheus
  • Gender:Male
  • Location:Brazil

Posted 18 April 2011, 05:26

Hi!

Lets say that because of a mod I implemented, I had to add extra columns, or even tables to my database. Would this add-on still work, i.e. would it backup column names or tables that are not originally in the stock install?

#127 DunWeb

  • Community Sponsor
  • 10,440 posts
  • Real Name:Chris Dunn
  • Gender:Male
  • Location:Tecumseh, Ontario, Canada N8N 1X8

Posted 18 April 2011, 06:33

Yes, this contribution will back up all tables within the database found in the configure.php file.




Chris
:|: Was this post helpful ? Click the LIKE THIS button :|:

:|: Click Here to learn how I can help you with custom coding, add ons, security and templates :|:

:|: Need an Area Calculator, Pre-Paid Account, Virtual Pin, Auction or Layaway Add on ? Click Here :|:

#128 modem2.0

  • Community Member
  • 43 posts
  • Real Name:Modem 2.0

Posted 03 May 2011, 17:57

Hi Spooks,

it seems that eregi_replace function has been deprecated in PHP5.3. Can you help to replace it? It is suggested to use the function ereg_replace() instead but I'm not very familiar with the pattern to use.

Br,

#129 modem2.0

  • Community Member
  • 43 posts
  • Real Name:Modem 2.0

Posted 18 May 2011, 10:04

View Postmodem2.0, on 03 May 2011, 17:57, said:

Hi Spooks,

it seems that eregi_replace function has been deprecated in PHP5.3. Can you help to replace it? It is suggested to use the function ereg_replace() instead but I'm not very familiar with the pattern to use.

Br,
Can someone help?

Thanks!

#130 sunshynecraftsbeads

  • Community Member
  • 144 posts
  • Real Name:Tracie Peters
  • Gender:Female
  • Location:British Columbia, Canada

Posted 30 May 2011, 05:13

Hi,


I have tried on 2 occasions to add this contribution with no luck. I have reviewed it over & over again and everything is where it should be ?

After following all the steps, I receive the following error message when I tried to sign into my web admin.

Parse error: syntax error, unexpected T_STRING in /home/sunshyn1/public_html/XXXXXX/includes/application_top.php on line 231



When I go into my

/home/sunshyn1/public_html/XXXXXX/includes/application_top.php

and remove the following I am able to sign into my admin but I do not have any backup features


if (tep_session_is_registered('admin')) require(DIR_WS_INCLUDES .'auto_backup_db.php');

This will only work if you log in to admin & create a admin session, if you use cpanel to log in you won't create the session, so to get around that, replace the above with:

require(DIR_WS_INCLUDES .'auto_backup_db.php');


Needless to say I am stumped. Any idea what I am doing wrong or can do to correct the problem.

Thank you in advance,
Tracie

#131 k_coreonegig

  • Community Member
  • 6 posts
  • Real Name:Kimmy McCann

Posted 22 June 2011, 21:20

View Postmodem2.0, on 18 May 2011, 10:04, said:

Can someone help?

Thanks!


I usually copy original code and then copy it out. That is the code you see below.
Try the following (should work, but I didn't test):

//$at_entry = eregi_replace(DB_DATABASE . '[_-]', '', $at_entry);
//$at_entry = eregi_replace('[.a-z]', '', $at_entry);
$at_entry = preg_replace(DB_DATABASE . '/[_-]/', '', $at_entry);
$at_entry = preg_replace('/[.a-z]/', '', $at_entry);
$at_last = strstr($at_last, DB_DATABASE);
//$at_last = eregi_replace(DB_DATABASE . '[_-]', '', $at_last);
//$at_last = eregi_replace('[.a-z]', '', $at_last);
$at_last = preg_replace(DB_DATABASE . '[_-]', '', $at_last);
$at_last = preg_replace('/[.a-z]/', '', $at_last);

#132 k_coreonegig

  • Community Member
  • 6 posts
  • Real Name:Kimmy McCann

Posted 23 June 2011, 00:49

View Postk_coreonegig, on 22 June 2011, 21:20, said:

I usually copy original code and then copy it out. That is the code you see below.
Try the following (should work, but I didn't test):

//$at_entry = eregi_replace(DB_DATABASE . '[_-]', '', $at_entry);
//$at_entry = eregi_replace('[.a-z]', '', $at_entry);
$at_entry = preg_replace(DB_DATABASE . '/[_-]/', '', $at_entry);
$at_entry = preg_replace('/[.a-z]/', '', $at_entry);
$at_last = strstr($at_last, DB_DATABASE);
//$at_last = eregi_replace(DB_DATABASE . '[_-]', '', $at_last);
//$at_last = eregi_replace('[.a-z]', '', $at_last);
$at_last = preg_replace(DB_DATABASE . '[_-]', '', $at_last);
$at_last = preg_replace('/[.a-z]/', '', $at_last);


Actually it appears I was wrong because I am getting errors.
Instructions can be found here by Spooks:
http://forums.oscommerce.com/topic/303380-contribution-auto-backup-database/page__st__100

I tried it, I am not getting errors now.

#133 Kezza0

  • Community Member
  • 4 posts
  • Real Name:Kerry

Posted 19 September 2011, 13:16

Hi, thanks for a great addon.

I have a heavily modded site I and trying to get this installed on and I get an error when I try and run the auto_backup_setup.php file.
I also get it when logging in and out sometimes.
If I am logging in and it happens and I press F5 to refresh then it shows the administration screen and I can carry on as normal.

I get
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

The error log says
Premature end of script headers: index.php
Premature end of script headers: login.php, referer: http://domainname/shop/admin/index.php
Premature end of script headers: auto_backup_setup.php

I have managed to install to another website with not very many mods, and it works well, doing backups.

Have renamed function bu_gzip to bu_gzip2 and also in auto_backup_db.php as I have Site Monitor installed.

Just wondering if you could possibly point me in the right direction to sort this out.

Many thanks.

Kezza

#134 Kezza0

  • Community Member
  • 4 posts
  • Real Name:Kerry

Posted 30 September 2011, 09:06

Hi, I also have an email sent that has some error lines in.

PHP Notice: Use of undefined constant STORE_NAME - assumed 'STORE_NAME' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 50
PHP Notice: Use of undefined constant REVIEW_TEXT_MIN_LENGTH - assumed 'REVIEW_TEXT_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 149
PHP Notice: Use of undefined constant ENTRY_FIRST_NAME_MIN_LENGTH - assumed 'ENTRY_FIRST_NAME_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 168
PHP Notice: Use of undefined constant ENTRY_LAST_NAME_MIN_LENGTH - assumed 'ENTRY_LAST_NAME_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 169
PHP Notice: Use of undefined constant ENTRY_EMAIL_ADDRESS_MIN_LENGTH - assumed 'ENTRY_EMAIL_ADDRESS_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 171
PHP Notice: Use of undefined constant ENTRY_STREET_ADDRESS_MIN_LENGTH - assumed 'ENTRY_STREET_ADDRESS_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 172
PHP Notice: Use of undefined constant ENTRY_POSTCODE_MIN_LENGTH - assumed 'ENTRY_POSTCODE_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 173
PHP Notice: Use of undefined constant ENTRY_CITY_MIN_LENGTH - assumed 'ENTRY_CITY_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 174
PHP Notice: Use of undefined constant ENTRY_TELEPHONE_MIN_LENGTH - assumed 'ENTRY_TELEPHONE_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 179
PHP Notice: Use of undefined constant ENTRY_PASSWORD_MIN_LENGTH - assumed 'ENTRY_PASSWORD_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 180
PHP Notice: Use of undefined constant ENTRY_FIRST_NAME_MIN_LENGTH - assumed 'ENTRY_FIRST_NAME_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 198
PHP Notice: Use of undefined constant ENTRY_LAST_NAME_MIN_LENGTH - assumed 'ENTRY_LAST_NAME_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 201
PHP Notice: Use of undefined constant ENTRY_EMAIL_ADDRESS_MIN_LENGTH - assumed 'ENTRY_EMAIL_ADDRESS_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 207
PHP Notice: Use of undefined constant ENTRY_STREET_ADDRESS_MIN_LENGTH - assumed 'ENTRY_STREET_ADDRESS_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 212
PHP Notice: Use of undefined constant ENTRY_POSTCODE_MIN_LENGTH - assumed 'ENTRY_POSTCODE_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 217
PHP Notice: Use of undefined constant ENTRY_CITY_MIN_LENGTH - assumed 'ENTRY_CITY_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 220
PHP Notice: Use of undefined constant ENTRY_STATE_MIN_LENGTH - assumed 'ENTRY_STATE_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 223
PHP Notice: Use of undefined constant ENTRY_TELEPHONE_MIN_LENGTH - assumed 'ENTRY_TELEPHONE_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 230
PHP Notice: Use of undefined constant ENTRY_PASSWORD_MIN_LENGTH - assumed 'ENTRY_PASSWORD_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 239
PHP Notice: Use of undefined constant ENTRY_PASSWORD_MIN_LENGTH - assumed 'ENTRY_PASSWORD_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 246
PHP Notice: Use of undefined constant ENTRY_PASSWORD_MIN_LENGTH - assumed 'ENTRY_PASSWORD_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 249
PHP Fatal error: Call to undefined function tep_href_link() in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 433

Any help for this would be appreciated.

Kezza

#135 spooks

  • Community Member
  • 7,017 posts
  • Real Name:Sam
  • Gender:Male
  • Location:UK

Posted 10 March 2012, 21:02

Auto Backup Database (Updated) V4 :)

Code re-written, now faster & more efficient (un-compressed backups are upto 50% smaller) backups take approx 1.5 secs per Mb (un-compressed).

Automatically backs up your database at regular intervals whilst you are logged into admin and create archive backups at a longer intervals.
Backups can be GZipped to conserve server space.
Backups can now be split or extended past max execution time if you have a very large dBase.
Backups are compatible with Database Backup Manager so selective restores can be made.
A cron job can also be set up to create timed daily backups, regardless of whether anyone logs in or not.
Archived backups can now also be auto deleted after a set period, so server won't fill up.
The 'sessions' and 'whos_online' tables are now automatically excluded from auto-backups, other exclusions can easily be added if needed.
The backup status is now only checked once every 5 minutes instead of on every page load.
As logfiles are created in the backup folder, modifications to Database Backup Manager are included to enable display/deletion of same.
Now includes separate language file to ease alterations for non English speakers.

Basic install is just 5 easy steps.

Compatible with all osC versions 2.3.1 and below.

Contribution found at http://addons.oscommerce.com/info/8374
Sam

Remember, What you think I ment may not be what I thought I ment when I said it.

Contributions:


Auto Backup your Database, Easy way

Multi Images with Fancy Pop-ups, Easy way

Products in columns with multi buy etc etc

Disable any Category or Product, Easy way

Secure & Improve your account pages et al.

#136 Hotclutch

  • Community Member
  • 1,243 posts
  • Real Name:Ashley
  • Gender:Male
  • Location:Cape Town, SA

Posted 11 March 2012, 21:42

Hi Sam

Nice to see you back :thumbsup:

Thanks for the update.

#137 mr_absinthe

  • Community Member
  • 411 posts
  • Real Name:Alex
  • Location:London, UK

Posted 12 March 2012, 13:43

Nice to see you back!
Absinthe Original Liquor Store

#138 mr_absinthe

  • Community Member
  • 411 posts
  • Real Name:Alex
  • Location:London, UK

Posted 12 March 2012, 16:44

The backup was created just fine, we'll see about deleted files.

Edited by mr_absinthe, 12 March 2012, 16:52.

Absinthe Original Liquor Store

#139 spooks

  • Community Member
  • 7,017 posts
  • Real Name:Sam
  • Gender:Male
  • Location:UK

Posted 12 March 2012, 17:23

@mr_absinthe

Good, there shouldn't be any issues, I could have mentioned before this has been tested with a 30Mb+ database of over 500,000 rows (average backup time was just over 30 secs)

The only case I`ve not setup for is if anyone has a very large database that would need a split backup and they don't use sessions for admin, but does anyone still do that?
Sam

Remember, What you think I ment may not be what I thought I ment when I said it.

Contributions:


Auto Backup your Database, Easy way

Multi Images with Fancy Pop-ups, Easy way

Products in columns with multi buy etc etc

Disable any Category or Product, Easy way

Secure & Improve your account pages et al.

#140 mr_absinthe

  • Community Member
  • 411 posts
  • Real Name:Alex
  • Location:London, UK

Posted 13 March 2012, 13:44

It is running fine on php 5.3.10, no issues so far. However on my other store with php 5.2.9, it does nothing. I've tried changing settings and still, nothing. Any idea please?

Edited by mr_absinthe, 13 March 2012, 13:49.

Absinthe Original Liquor Store