News and backup: Difference between revisions

From CCMDB Wiki
Jump to navigation Jump to search
mNo edit summary
 
(125 intermediate revisions by 19 users not shown)
Line 1: Line 1:
The "'''News and Backup'''" batch file is a batch file on each '''laptop''' used to back up data.
This article is about the "'''News and Backup'''" process collectors use to back up data from their '''laptop'''.


== Backup using the file ==
== Backing up ==
'''To back up, double-click on the "News and Backup" shortcut on your desktop.'''
'''To back up, double-click on the "News and Backup" shortcut on your desktop.'''
=== Off line mode ===
=== How often should you run News and Backup? ===
When not hooked up to the network the batch file will backup data to the SD Card
The following are the '''minimally required news and backups''' and their reasons:
=== On-line mode ===
# at '''beginning of collection with a laptop''' before data entry
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.
#*this ensures that you have the newest version of the '''program''' and '''any internal data changes (e.g. dropdowns, cross-checks)'''
# when the email about the [[Cognos]] data arrives
#* this ensures that you have the newest version of the '''Cognos data'''
# at '''end of collection day with a laptop''' (whether you send or not)
#* very rarely things go wrong during sending; making a backup just before sending means we would be able to restore you to that version if sending corrupts your data
#* also, it gives main office data to go on if they have to do any "forensics" on your data if send made a mess at our end; sometimes the [[Data processor]] will re-send data from this backup so you don't have to.
# '''just before [[sending]]''''
# '''after [[sending]]''' but '''before DELETING''' any files from laptop
#* again, this gives the main office data to review in case something went wrong with the send.


== Operation of the file ==
You can additionally back up mid day. In theory you can do this as frequently as you want, but there are draw backs: we only keep the last 40 backups, so if you back up 10 times a day we only have 2 days of backups for you. So, if we found out that we want to know something that happened last week, then if you did 10 a day we would no longer have the data, but if you did 3 a day, we usually would still have the data. So, be reasonable in your backup frequency.
'' For the most up-to-date workings of this file see the file itself and the change log [[News and Backup Change Log]]''
 
==Importance of backup to REGIONAL SERVER==
The Main office has the opportunity to get data from these backups if there is a problem.
*Example of this is June 7.13 when new program was rolled out, postal code and color for overstay in TMP was being sent to TMPV2.mdb as [[Chinese characters being sent to TmpV2 | "chinese  type" letters]].  Main office was able to retrieve from regional server for site that backed up their data.[[User:TOstryzniuk|Trish Ostryzniuk]] 17:00, 2013 June 10 (EDT)
*another example of this: Nov.13 - discovered that ICU Pharmacy items YES NO not going into pharmacy.mdb or centralized.mdb from first week of June to Aug 13.13.  Because of backups to Regional Server, the Main office had the opportunity to pull together copies of these backups and retrieve the "lost pharm data".  This has saved the data collector from having to recollect pharmacy data from the chart.[[User:TOstryzniuk|Trish Ostryzniuk]] 15:49, 2013 December 3 (CST)
 
== Process ==
'' For the most up-to-date workings of this file see the file itself and the change logs at [[Batstart.bat#Log]] and [[Backup.bat#Log]]


The "'''News and Backup'''" batch file is a batch file on each '''laptop''' which does the following:  
The "'''News and Backup'''" batch file is a batch file on each '''laptop''' which does the following:  
* checks if there is a newer version of itself (technically it's the caller batch file that does this...)
* [[batstart.bat]]
* back up [[CCMDB_data.mdb|c:\ccmdb_data\ccmdb_data.mdb]] to the SD card
** sets the [[Laptop identifier]]
* back up to server w 20 versions
** checks if there is a newer version of [[backup.bat]]; if so, it downloads it
** delete [[Regional Server]]\Programs\<hosp>_<ward>\ccmdb.20
** calls [[backup.bat]]
** rename ccmdb.19 to ccmdb.20, ccmdb18 to ccmdb.19, ... ccmdb.1 to ccmdb.2, ccmdb.mdb to ccmdb.1
* [[backup.bat]]
** copy c:\ccmdb_'''data'''\ccmdb_data.mdb to [[Regional Server]]\data\<hosp>_<ward>
** back up to local backup directory c:\ccmdb_data\ccmdb_backups w 20 versions of [[CCMDB_data.mdb]]
* check if there is a file [[Regional Server]]\Programs\<hosp>_<ward>\ccmdb.mdb; if so,  
** back up to server w 40 versions of [[CCMDB_data.mdb]] to the regional server
** check if there is a file [[Regional Server]]\Programs\<hosp>_<ward>\ccmdb.accdb; if so,  
** '''move''' the file from the regional server to c:\ccmdb_'''program'''
** '''move''' the file from the regional server to c:\ccmdb_'''program'''
** open the wiki to [[Log]] to show what has changed
** open the wiki to [[Log]] to show what has changed
** copy log file CCMDB_backup_log.txt to the corresponding [[Regional Server]]\data\<[[Laptop identifier]]>; this log would show you when people have run news and backup and if there were errors.


== Setting up the file on a laptop ==
== Setting up the file on a laptop ==
If the laptop is set up according to [[Laptop Setup]] then the batch files and shortcuts will be copied down as part of the process. The only thing to do locally would be to [[#Edit parameters for location | edit parameters for location]].
If the laptop is set up according to [[Laptop Setup]] then the batch files and shortcuts will be copied down as part of the process.  
 
*The only thing to do locally would be to [[#Edit parameters for identifier]].
=== Master file location ===
If not already done during [[Laptop Setup]], 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 for identifier ===
* '''edit parameters''' -  only the "Location Specific Parameters" section of c:\batches\batstart.bat
# right-click the news-and-backup shortcut and click "edit"
#* '''Don't double-click''' because that would run the file
#* [[File:News and backup context menu.png | 150px]]
# go to the line that starts with "set ml=", should be around line 12
# change the "somewhere" to the [[Laptop identifier]], i.e. your directory on the regional server, e.g. HSC_H4
#* don't add spaces
#* make sure it's the directory used for the [[Laptop identifier]], for legacy reasons this might not be the main ward now collected on
# menu file save, menu file close
#* [[File:News and backup edit menu.png | 400px]]


=== if the shortcut is missing... ===
=== if the shortcut is missing... ===
see [[All shortcuts fixer.bat]]
see [[Desktop install.bat]]


== Testing News and Backup ==
== Testing News and Backup ==
After initial setup test that the backup works:
After initial setup test that the backup works:
* make some change in ccmdb.mdb to update date stamp of file on the client laptop
* open and close [[CCMDB.accdb]] to update date stamp of file on the client laptop
* execute the News and Backup batch file to perform the process
* execute the News and Backup batch file to perform the process
* check that ccmdb.mdb file with new stamp is on sd card
* check that [[CCMDB.accdb]] file with new stamp is on c:\ccmdb_data\ccmdb_backups
* check that ccmdb.mdb file with new stamp is on [[Regional Server]]/data/<hsp>_<ward>
* check that [[CCMDB.accdb]] file with new stamp is on [[Regional Server]]/data/<hsp>_<ward>


== Information about the batch files ==
== Information about the batch files ==
A two-file system is used to allow batstart.bat to actually look for a '''new''' backup.bat on regional server\programs\<location> before each run, allowing a central update of that file if necessary. This allows for centralized updating/tweaking/etc of the laptops.  
A two-file system is used to allow [[batstart.bat]] to actually look for a '''new''' [[backup.bat]] before each run, allowing a central update of that file if necessary. This allows for centralized updating/tweaking/etc of the laptops.  


Batstart.bat uses Robocopy, sort of an improved version of xcopy, which is available from Microsoft as part of one of their Server SDKs.
[[Batstart.bat]] uses Robocopy, sort of an improved version of xcopy, which is available from Microsoft as part of one of their Server SDKs.


== Updating the file ==
== Updating the file ==
I will need to test that the update still works since we had to cheat the system to get the new regional server hooked in. Ttenbergen 18:23, 2013 March 21 (EDT)
BatStart.bat looks for an update to backup.bat in regional server\programs\<[[Laptop identifier]]>; that file will replace the local one.
 
Make sure [[Batstart.bat#Log]]/[[Backup.bat#Log]] is updated with any changes.
 
== Error checking ==
Just do your backups and assume they work, there is no need for collectors to routinely check that the backups to the regional server are working. [[Data Processor]] in Main office checks regularly that backups are being done, so if backups are not making it to the regional server we will let you know.  


BatStart.bat looks on an update to backup.bat in regional server\programs\<location>; that file will replace the local one.
== Related articles ==
{{Discussion}}
{{Related Articles}}
Is this fixed now?-[[User:TOstryzniuk|Trish Ostryzniuk]] 16:55, 2013 June 10 (EDT)




[[Category: Batch Files]]
[[Category: Batch Files]]
[[Category: Data Backup Dependencies]]
[[Category: Data Backup Dependencies]]
[[Category: Backup]]

Latest revision as of 21:22, 2023 April 5

This article is about the "News and Backup" process collectors use to back up data from their laptop.

Backing up

To back up, double-click on the "News and Backup" shortcut on your desktop.

How often should you run News and Backup?

The following are the minimally required news and backups and their reasons:

  1. at beginning of collection with a laptop before data entry
    • this ensures that you have the newest version of the program and any internal data changes (e.g. dropdowns, cross-checks)
  2. when the email about the Cognos data arrives
    • this ensures that you have the newest version of the Cognos data
  3. at end of collection day with a laptop (whether you send or not)
    • very rarely things go wrong during sending; making a backup just before sending means we would be able to restore you to that version if sending corrupts your data
    • also, it gives main office data to go on if they have to do any "forensics" on your data if send made a mess at our end; sometimes the Data processor will re-send data from this backup so you don't have to.
  4. just before sending'
  5. after sending but before DELETING any files from laptop
    • again, this gives the main office data to review in case something went wrong with the send.

You can additionally back up mid day. In theory you can do this as frequently as you want, but there are draw backs: we only keep the last 40 backups, so if you back up 10 times a day we only have 2 days of backups for you. So, if we found out that we want to know something that happened last week, then if you did 10 a day we would no longer have the data, but if you did 3 a day, we usually would still have the data. So, be reasonable in your backup frequency.

Importance of backup to REGIONAL SERVER

The Main office has the opportunity to get data from these backups if there is a problem.

  • Example of this is June 7.13 when new program was rolled out, postal code and color for overstay in TMP was being sent to TMPV2.mdb as "chinese type" letters. Main office was able to retrieve from regional server for site that backed up their data.Trish Ostryzniuk 17:00, 2013 June 10 (EDT)
  • another example of this: Nov.13 - discovered that ICU Pharmacy items YES NO not going into pharmacy.mdb or centralized.mdb from first week of June to Aug 13.13. Because of backups to Regional Server, the Main office had the opportunity to pull together copies of these backups and retrieve the "lost pharm data". This has saved the data collector from having to recollect pharmacy data from the chart.Trish Ostryzniuk 15:49, 2013 December 3 (CST)

Process

For the most up-to-date workings of this file see the file itself and the change logs at Batstart.bat#Log and Backup.bat#Log

The "News and Backup" batch file is a batch file on each laptop which does the following:

Setting up the file on a laptop

If the laptop is set up according to Laptop Setup then the batch files and shortcuts will be copied down as part of the process.

Edit parameters for identifier

  1. right-click the news-and-backup shortcut and click "edit"
    • Don't double-click because that would run the file
  2. go to the line that starts with "set ml=", should be around line 12
  3. change the "somewhere" to the Laptop identifier, i.e. your directory on the regional server, e.g. HSC_H4
    • don't add spaces
    • make sure it's the directory used for the Laptop identifier, for legacy reasons this might not be the main ward now collected on
  4. menu file save, menu file close

if the shortcut is missing...

see Desktop install.bat

Testing News and Backup

After initial setup test that the backup works:

  • open and close CCMDB.accdb to update date stamp of file on the client laptop
  • execute the News and Backup batch file to perform the process
  • check that CCMDB.accdb file with new stamp is on c:\ccmdb_data\ccmdb_backups
  • check that CCMDB.accdb file with new stamp is on Regional Server/data/<hsp>_<ward>

Information about the batch files

A two-file system is used to allow batstart.bat to actually look for a new backup.bat before each run, allowing a central update of that file if necessary. This allows for centralized updating/tweaking/etc of the laptops.

Batstart.bat uses Robocopy, sort of an improved version of xcopy, which is available from Microsoft as part of one of their Server SDKs.

Updating the file

BatStart.bat looks for an update to backup.bat in regional server\programs\<Laptop identifier>; that file will replace the local one.

Make sure Batstart.bat#Log/Backup.bat#Log is updated with any changes.

Error checking

Just do your backups and assume they work, there is no need for collectors to routinely check that the backups to the regional server are working. Data Processor in Main office checks regularly that backups are being done, so if backups are not making it to the regional server we will let you know.

Related articles

Related articles: