Windows Backup And Restore Made Easy
This process of backup is a refinement and simplification of Joe Holzer's method. Knowledge of programming and of Command Prompt is not required.
In reference to the built-in backup utility, once constructed properly, this method is just as simple to use. Comments in the OpenEMR Forums stressed that browser-based backups are not reliable (refer to this Forum thread). In a recently restored backup after using the native tool, all the scanned documents were missing and the LBV forms had to be re-configured. Recovery with this method does not necessitate the unbundling of the backup file, copying and replacing of the openemr\sites\default folder and the rebuilding of the MySQL database.
Unlike the Joe Holzer method the entire XAMPP directory is replicated, not just the four htdocs\openemr folders and the MySQL database. Recovery does not require that XAMPP-OpenEMR be downloaded and the files to be copied onto the download.
Screenshots are from a Windows 7 machine.
Two pieces of information are necessary before construction of the tool.
1) The version of Apache must be known. A quick way to find out, go to Control Panel->Systems and Security-> Administrative Tools->Services. In the list of Services, look for the number next to Apache.
2) You will need to know the letter drive of the backup device. Insert the device. Go to Windows Explorer, under Computer is the letter of the drive.
1) Open Notepad to create an empty file. (changed this:
2) Under the File tab, choose Save As, type in check.bat as the File Name and use the default Text Documents as the Save As Type. Save to C-drive. Click Save.
3) Verify that it is in C-drive by going to Windows Explorer and then to C-drive.
4) Open Notepad again, copy and paste the following set of commands:
net stop "mysql"
net stop "apache2.4"
cmd /c cd C:\
if exist C:\check.bat xcopy C:\xampp\*.* F:\xampp\ /d /e /c /i /f /h /k /y
net start "apache2.4"
net start "mysql"
5) Change the version of Apache if it is not 2.4 in lines 2 and 5 of the script and the drive letter if it is not F in line 4.
6) It is very important that these next 2 steps are executed exactly as stated to avoid problems. Under the File tab, choose Save As. In the File Name bar, type in C:\users\XXX\desktop\backup.cmd where XXX is the name of the account that you signed into at the Windows Welcome Screen.
7) In the Save As Type bar, click the drop down menu and choose All Files. The File will be saved to your Desktop. Click Save. If you use the default of Text Documents, you will have only a document of the instructions and not the actual command to execute the backup.
8) Go to the Desktop. If you see two cogged gears, then the text file was successfully converted into a command file.
1) Log off OpenEMR.
2) Double click the backup.cmd icon on your Desktop.
3) Command Prompt will appear and start the backup and save it to your device. Flash drives, SD cards and external hard drives have been used successfully as backup media. DVD's have not been tested. To change the drive of the destination device, right click on the backup.cmd icon and choose Edit.
4) When Command Prompt has completed the task, it will close automatically and a new folder, XAMPP, will appear on the backup device.
5) To have more than one backup in time you can do the following: In Windows Explorer go to your Backup folder: F:/XAMPP and rename this folder into XAMPP-yyyymmdd (add the date you made your backup). This will avoid overwriting this folder when making your next back-up. When restoring the file you have to rename the folder again into: F:/XAMPP
1) Send the XAMPP folder to C-drive.
2) Go to C:->XAMPP->XAMPP Control and double click that file. The orange icon has a symbol that looks like a dog bone in the middle.
3) Under Modules Service click the red x changing it to a green check mark to install Apache and then under Actions, click Start to begin the service. Do the same for MySQL. You have to "turn on the lights" before getting back to work. Both modules are ready to use when the PID(s) and Port(s) are populated with numbers.
4) If you are interested in verification of the accuracy of the backup using just the copy on the destination device, you may need to use XAMPP Start and XAMPP Stop if XAMPP Control does not work. The copy on the device runs only at 80% speed compared to that installed on C-drive, but it is still a very handy feature if verification is the only objective..
5) Log on by typing in http://localhost/openemer in the URL bar. Now it is back to work we go.
The elegant script and technical advice have been graciously supplied by Christopher Verkler, M.D. It would not have been possible for us to construct the tool without the invaluable technical assistance of Kevin Yeh, M.D., of IntegralEMR. Pieter W. Blankevoort, M.D., (a.k.a. the LBV Guru) was kind enough to take time from his medical practice on a sunny isle to brainstorm.
Good luck and smooth sailing.