News and backup
The "News and Backup" batch file is a batch file on each laptop used to back up data.
Backup using the file
To back up, double-click on the "News and Backup" shortcut on your desktop.
Off line mode
When not hooked up to the network the batch file will backup data to the SD Card
On-line mode
When hooked up to the network, the batch file will perform the off-line work, but also back-up the data to the regional server and copy down a new version of CCMDB.mdb if available.
Operation of the file
The "News and Backup" batch file is a batch file on each laptop which does the following:
- back up c:\ccmdb_data\ccmdb_data.mdb to the SD card
- back up to server w 20 versions
- delete Regional Server\Programs\<hosp>_<ward>\ccmdb.20
- rename ccmdb.19 to ccmdb.20, ccmdb18 to ccmdb.19, ... ccmdb.1 to ccmdb.2, ccmdb.mdb to ccmdb.1
- copy c:\ccmdb_data\ccmdb_data.mdb to Regional Server\data\<hosp>_<ward>
- check if there is a file Regional Server\Programs\<hosp>_<ward>\ccmdb.mdb; if so,
- move the file from the regional server to c:\ccmdb_program
- open the wiki to Log to show what has changed
Setting up the file on a laptop
Master file location
Copy from master file location
- Regional Server\maintenance\laptop batches\* --> c:\batches
Edit parameters for location
To edit a batch file, right-click and edit the file. Don't double-click because that would RUN the file batstart.bat contains lines that serve as parameters for the file to work in different locations. For the most part, all possible entries are present in the file, with the ones not applicable for a location "commented out". To comment out a line, put a ":" (without the quotes) in front of the line you don't want to run.
- edit parameters - only the "Location Specific Parameters" section of c:\batches\batstart.bat
Make a shortcut
- Make shortcut
- C:\Documents and Settings\All Users\Desktop\News and backup (keep name consistent for communications)
- to
- c:\batches\batstart.bat
Testing News and Backup
Prep
- Copy the file
- Regional Server\Programs\master\ccmdb.mdb
- to
- Regional Server\Programs\<hosp>_<ward>\ccmdb.mdb
- rename the ccmdb.mdb file on the SD card if present
Run
Double-click the News and Backup shortcut on the desktop
Confirm
- check that ccmdb.mdb is gone from ...\<hosp>_<ward>
- check that ccmdb.mdb is present on SD card
If this is not working, adjust the settings in the batstart.bat. You should not need to adjust the settings in the rest of the batch file.
Information about the batch files
A two-file system is used to allow batstart.bat to actually look for a new backup.bat on the regional server before each run, allowing a central update of that file if necessary. This would allow for centralized updating/tweaking/etc of the laptops.
Backup.bat uses Robocopy, sort of an improved version of xcopy, which is available from Microsoft as part of one of their Server SDKs.