By Jeff Moses
| Alpha Five version 5 will have built-in backup capabilities, but until version 5 comes out, A5 users and developers will exercise their ingenuity in making sure that backups are easy and comprehensive. You may have read Tom Cone's article on backups. Jeff Moses(active@en.com), an Alpha developer in Chardon, Ohio, writes how he ensures that his clients perform proper backup. |
We begin by writing a set of DOS batch files that will accommodate any drive letter A to G. It is necessary to use individual files for each drive letter, as we have not yet figured out a way to load a batch file variable from within A5. Our database is located in a directory called "POS". Our database is named IRIS (Invoice, Repair Order, and Inventory System). Our batch files are named backa.bat, backb.bat, backc.bat and so on for as many drives as you want to make available to backup to. The following is the text in our backup batch file that would backup up to drive C.
md c:\irisback copy c:\pos\*.* c:\irisback
The file above makes a directory called "irisback" on drive C: and then copies the entire POS directory to it. This could be modified to only copy dbf files if you wanted to save room but we copy the whole directory so we can also offer a full restore as of the last backup in case something happens to the master program. Once all of the batch files have been written we copy them into our POS directory so they always stay with and become a permanent part of the application. They are also run from within the POS directory.
In addition to backup files we also create another set of similar batch files that will restore all of the files in "irisback" to the POS directory. These files would be named restorea, restoreb, restorec, and so on for as many drive letters as you have made available as backups. The following is the text in our restore file that would restore IRIS from drive C:.
md c:\pos copy c:\irisback\*.* c:\pos
It is always safer to include the md\c:\pos line just incase the directory was removed for some reason. The batch file will ignore it if it already exists. We find that many of our customers find the restore option very useful especially if they want to keep a current copy of the program on another system such as their home. They can backup at the end of the day to a zip disk and then restore to the system at home every night.
Now to A5. We have created a special form in our application called utilities that handles our backup, restore, new product imports/update operations, system tune-up, database compression and access to control panel. Access to the control panel can only be done by using an unlock code that is a mathematical equation. This code changes every day, as one of the numbers it uses is the amount of days between a past date and the current date. Our customers must call us to get the code and that way we can assure the integrity of our application by them not having access to the control panel anywhere in the system.
As for the backup and restore we have two buttons in this screen, one labeled "Backup IRIS" and one labeled "Restore Last Backup". The Buttons have a message box that appears first to explain what is about to happen and offer the user the option to cancel. If the user chooses to continue the action then offers a radio button Quick Dialog box that prompts the user to select the drive to backup to. The drive letters A to G are offered as options. Each of the drive letters in the radio button box in turn has the corresponding backup batch file connected to it via the "Run Program" action command and c:\pos\backc.bat entered in the command line (I am assuming the user chose to backup to C.)

Figure 1. We used Action Scripting to create our backup scripts.
At the very end of the script we have the A5.close() command. If you try this you will notice that A5 will close immediately and the DOS window will do its stuff. We also enter a message prior to the backup that A5 will be shut down and will need to be restarted.

Figure 2. We had to use one line of Xbasic, an A5.close()
Another place and probably the most convenient place we place the backup system is in our Main Menu where the application "Exit IRIS" button is. We have a message box pop up that asks the user if he or she would like to backup at this time. If yes, then the above actions would then take place.
Here is the Main Menu for our application:
Figure 3. Our Main Menu Screen.
When the user presses the Exit button, a backup reminder pops up:

Figure 4. Reminding the user to make a backup.

Figure 5. The Action Script asks the user which drive to use for backup.
In restoring, by copying the entire application when backing up, the user can open up the last backup right from the "irisback" directory and use the restore button in that copy. That will place the backup copy back into the POS directory.
I hope this is of some help to you and other A5 users. It has been thoroughly test and used for over 18 months without a single problem. Our customers are very happy with it and it has saved a lot of data!
We have had a lot of experience dealing with operations of backup and installing and updating our applications in our customers systems. You can download a set of sample files to show you how we do our backups!
11/15/99
Don't forget, we need your feedback to make this site better!