Backups are not downloading

ajperezcrespo wrote on Monday, January 02, 2012:

Hi,
  When a backup is run (Administrafion->Backup) the process seems to run correctly.  In fact I can see the backup being created in the /tmp/openemr_eb_backup/emr_backup.  But it never download.

Any thoughts?
Ubuntu 11.04
Apache version 2.2.17
MySQL version 5.1.54
OpenEMR v4.1.0 (5)
PHP version 5.3.5

Thanks
Alfonso

tmccormi wrote on Monday, January 02, 2012:

I have seen this happen as well, but I have not been able to pin down why.  It’s like the java script to start the download dialog doesn’t fire.  
-Tony

bradymiller wrote on Tuesday, January 03, 2012:

Hi,
Anything showing up in the php error log or the javascript error log. Also, is it happening on all browsers or a specific one? Also, is the script timing out?
-brady

nursejeff wrote on Wednesday, January 04, 2012:

I’ve had this problem since I posted it on Nov 7th.  There is no error noted in the php error log.  This happens with all browsers.

Jeff
NP Health Clinic

nursejeff wrote on Monday, April 30, 2012:

This error is persisting.  Has anyone explored this further or been able to resolve this issue?  Is there anything I can do to help solve this?

Thanks again.

Jeff
NP Health Clinic

yehster wrote on Monday, April 30, 2012:

I made some changes related to the backup process in January.
https://github.com/openemr/openemr/commit/12103ca25f93247bafdd25f7f51eedd3963bdb0f
Not sure if those changes address your specific problems though.

nursejeff wrote on Tuesday, May 01, 2012:

Hi yehster,

It appears that this change had been made already.  I just upgraded to patch 10 and I am still having the same problem.

Jeff
NP Health Clinic

bradymiller wrote on Wednesday, May 02, 2012:

Hi,
How big is the backup file at /tmp/openemr_eb_backup/emr_backup when it  stops getting any bigger?
-brady
OpenEMR

nursejeff wrote on Wednesday, May 02, 2012:

Hi brady

openemr.sql.gz = 4MB
openemr.tar.gz = 1088MB

Jeff

bradymiller wrote on Saturday, May 05, 2012:

Hi,
So it never makes the emr_backup.tar file then?
I wonder if it’s related to a timeout from apache:
http://httpd.apache.org/docs/2.0/mod/core.html#timeout
-brady
OpenEMR

nursejeff wrote on Monday, May 07, 2012:

There is a new     emr_backup.tar     which is 1130MB in size in the         /tmp/openemr_web_backup .

There is also two files under      /tmp/openemr_web_backup/emr_backup      that are      openemr.sql.gz = 4MB    and   openemr.tar.gz = 1125MB .

Jeff

mschap wrote on Sunday, July 01, 2012:

I too am having this problem - worked up until the emr backup file reached a size above 493 MB (size of the last successful backup).

mschap wrote on Sunday, July 01, 2012:

When I try to open the openemr.tar.gc file from the tmp folder I get the following:
gzip: stdin: invalid compressed data-crc error
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now

mschap wrote on Sunday, July 01, 2012:

Okay, I answered my own question as to what the problem is:  in the php.ini file (just search for it)  increase the max_execution_time from its current setting to something a little more extreme like 1080 - this gives enough time and the back up will work fine.

tmccormi wrote on Monday, July 02, 2012:

Until it gets too big again.  The demand backup via the browser is not a long term solution.  You need to implement a automated backup script…

It’s not hard, you need only use mysqldump to copy the database out to text and and kind of tar, zip, copy, rsync, xcopy to make a snapshot of it all and put it somewhere other than the same machine.

There is an linux example in contribs/util  called backup_oemr.sh, would be easy to do a windows cmd shell version of it.

-Tony

nursejeff wrote on Saturday, September 22, 2012:

I increased the max_execution_time but this did not fix the problem.

Jeff
NP Health Clinic

tmccormi wrote on Saturday, September 22, 2012:

I have found that using the backups via the web client, whether through the OpenEMR backup selection or via phpmyAdmin can fail, and frequently they fail silently on large databases.

The ONLY safe way to backup your database is from the command line with the mysql tables locked during the dump.

Use the examples provided in the contrib/util/backup_oemr.sh.   If you are windows based either install cygwin so you have a unix shell command or convert the script to windows .cmd format.

Or… find a good mysql UI backup application tool that IS NOT browser based.

-Tony

bradymiller wrote on Saturday, September 22, 2012:

Hi,

Since there is a rather large variety of combinations on backup methods, would be nice to get more details on backup methods on the wiki:
http://www.open-emr.org/wiki/index.php/OpenEMR_Backup_Tools

Also, to clarify (correct me if I am wrong), byt mysqldump by default has the -opt parameter on, which locks tables (so, as long as use this command with using any parameters to explicitly remove locks, should be fine; that being said, always good practice to include -opt in the command, which is done in backup method within OpenEMR).

The backup script should work (since it is utilizing mysqldump with lock and appropriate copy of the web files), but I think the main issue seems to be the download issues.

I agree with Tony (in a way). Ideally, the user implements a automated command line tool to backup their OpenEMR frequently and off site. However, the natural progression of new users will likely be to use the internal OpenEMR backup mechanism(ie. limit their initial resource investment) until they become comfortable to either implement a more sophisticated method (or hire somebody to do it). (This is where documentation on various backup methods in the wiki would be extremely helpful)

So, is is beneficial for this thing to work correctly. Also with bug in this script reported by:
http://sourceforge.net/projects/openemr/forums/forum/202505/topic/5789277

To debug, curious to know in both Jeff and rdh61 cases the files/directories and sizes you see at /tmp/openemr_web_backup after running the backup script (note the files will keep getting bigger while the script is running, so wait until files stop growing)

-brady
OpenEMR

rdh61 wrote on Saturday, September 22, 2012:

Final size of directories / files:

emr_backup:     7.9 MB
openemr.sql.gz:     1.1 MB
openemr.tar.gz:     6.8 MB

rdh61 wrote on Saturday, September 22, 2012:

Sorry, disconsider my last post. These were the sizes after attempting to back up with the browser, not manually using the script.

However, the problem for me has been solved by referring to yehster’s post (nº 6) above.

In interface/main//backup.php, line 36 was empty. I added this code:

set_time_limit(0);

The backup  now completes successfully.