Difference between revisions of "Ignacio Valdes Implementation Log/Episode31"

From VistApedia
Jump to: navigation, search
 
Line 1: Line 1:
Intracare Implementation Log Episode 31: 'Cowboy' System Backup
+
I've changed over to journaling and now have a backup system to a USB drive.
 
Reply
 
 
|
 
Ignacio Valdes
 
to hardhats
 
 
show details 11/26/08
 
 
Hello all, the following terminal session is described as a 'Cowboy'
 
way of bringing the system down, backing it up and bringing it back
 
up. It shows how to shut down taskman and all the other processes,
 
backup the mumps.dat file and bring taskman back up. If anyone would
 
like to advise or post the civilized way of doing this, please feel
 
free.
 
  
[vista@vista ~]$ ps -C mumps
+
Use the parent posting terminal session to take down the system, then
PID TTY          TIME CMD
+
where it has the backup command, instead do:
2701 ?        00:22:33 mumps
 
6744 ?        00:00:00 mumps
 
6849 ?        00:00:00 mumps
 
7014 ?        00:00:00 mumps
 
7120 ?        00:00:00 mumps
 
7388 ?        00:01:23 mumps
 
11476 ?        00:00:00 mumps
 
[vista@vista ~]$ gtm
 
  
GTM>D ^ZSY
+
mupip set -journal="enable,on,before" -region "*"
  
GT.M system status /bin/bash: mupip: command not found
+
then bring the system back up as above.
/bin/bash: mupip: command not found
 
/bin/bash: mupip: command not found
 
/bin/bash: mupip: command not found
 
/bin/bash: mupip: command not found
 
/bin/bash: mupip: command not found
 
/bin/bash: mupip: command not found
 
/bin/bash: mupip: command not found
 
  
GT.M Mumps users on 26-Nov-08 09:45:16
+
Here is a quickie backup script called nightlybak.sh that is self
 +
explanatory in the comments on how to set it up using cron to run
 +
every night at 5. This does not require taking down the system. It can
 +
be run with or without cron. Remember to chmod +x to make it
 +
executable on Linux. Good compression is achievable with this via tar
 +
-czf, I was able to get about a 70% file size reduction. No guarantees
 +
on this, use at your own risk, has been tested some.
  
Proc. id Proc. name      PS  Device  Routine            MODE    CPU time
+
You should encrypt the USB drive prior to backing up to prevent
-------- --------------- --- -------- --------          -------
+
patient data turning up somewhere it should not but right now I do not
2701                    hib                            -direct  00:22:33
+
know how to format a USB drive encrypted and using Linux. Can anyone
6744                    T                              -r      00:00:00
+
help with that?
6849                    T                              -r      00:00:00
 
7014                    T                              -r      00:00:00
 
7120                    T                              -r      00:00:00
 
7388    Taskman EHR 1  hib                            -direct  00:01:23
 
11476    ip10.166:0      hib                            -run    00:00:00
 
11698                    S+  pts/1                      -direct  00:00:00
 
  
Total 8 users.
+
Comments? Thoughts? Rotten tomatoes?
  
 +
-- IV
  
GTM>D STOP^ZTMKU
+
******* begin script *******
 +
#!/bin/bash
 +
# nightlybak.sh
 +
# Quickie daily backup, should be run with cron.
 +
# Use crontab -e with the follwing in the crontab file:
 +
# MAILTO=youremail@somewhere.org
 +
# 00 5 * * * /home/vista/EHR/nightlybak.sh
 +
#
 +
# The above crontab will run every day at 5 and will run the script below
 +
# if placed in the proper subdirectory. This will create a backup on the primary
 +
# machine, tar it and compress it, then copy it to an external media.
 +
# It will then email that it has done it.
 +
# Caveats: This has very little error-checking for media present and writable.
 +
# This has been somewhat tested on Fedora 9 Linux.
 +
# No guarantees or warranties expressed or implied, use at your own risk.
 +
# Author: Ignacio Valdes, MD, MS
 +
# 12/18/08
 +
#
 +
FN=/home/vista/EHR/g/backup/mumps.dat.bak_$(date +%Y%m%d)
 +
TGZFN=/home/vista/EHR/g/backup/mumps.dat.bak_$(date +%Y%m%d).tgz
 +
/usr/local/gtm/mupip backup -database -nojournal "*" $FN
 +
tar -czf $TGZFN $FN
 +
# copy to previously mounted removable media.
 +
cp $TGZFN /media/My\ Book/
 +
# Clean up a little bit.
 +
rm $FN
 +
****** End Script ******
  
 
+
All rights reserved - Ignacio Valdes
Are you sure you want to stop TaskMan? NO// Y
 
Shutting down TaskMan.
 
 
 
Should active submanagers shut down after finishing their current tasks? NO// Y
 
Okay!
 
 
 
GTM>h
 
[vista@vista ~]$ ps -C mumps
 
PID TTY          TIME CMD
 
6744 ?        00:00:00 mumps
 
6849 ?        00:00:00 mumps
 
7014 ?        00:00:00 mumps
 
7120 ?        00:00:00 mumps
 
11476 ?        00:00:00 mumps
 
[vista@vista ~]$ /usr/local/gtm/mupip stop 6744
 
STOP issued to process 6744
 
[vista@vista ~]$ /usr/local/gtm/mupip stop 6849
 
STOP issued to process 6849
 
[vista@vista ~]$ /usr/local/gtm/mupip stop 7014
 
STOP issued to process 7014
 
[vista@vista ~]$ /usr/local/gtm/mupip stop 7120
 
STOP issued to process 7120
 
[vista@vista ~]$ /usr/local/gtm/mupip stop 11476
 
STOP issued to process 11476
 
[vista@vista ~]$ ps -C mumps
 
PID TTY          TIME CMD
 
6744 ?        00:00:00 mumps
 
6849 ?        00:00:00 mumps
 
7014 ?        00:00:00 mumps
 
7120 ?        00:00:00 mumps
 
[vista@vista ~]$ ps -C mumps
 
PID TTY          TIME CMD
 
6744 ?        00:00:00 mumps
 
6849 ?        00:00:00 mumps
 
7014 ?        00:00:00 mumps
 
7120 ?        00:00:00 mumps
 
[vista@vista ~]$ /usr/local/gtm/mupip rundown -r "*"
 
%GTM-I-MUFILRNDWNSUC, File /home/vista/EHR/g/mumps.dat successfully rundown
 
[vista@vista ~]$ /usr/local/gtm/mupip rundown
 
[vista@vista ~]$ echo $gtmgbldir
 
/home/vista/EHR/g/mumps.gld
 
[vista@vista ~]$ cd EHR/g
 
[vista@vista g]$ ls
 
b0rken_mumps.dat  b0rken_mumps.gld  mumps.dat  mumps.gld
 
[vista@vista g]$ cp mumps.dat mumps.dat.bak.112608
 
[vista@vista g]$ cd
 
[vista@vista ~]$ gtm
 
 
 
GTM>D ^ZTMB
 
 
 
GTM>D ^ZSY
 
 
 
GT.M system status /bin/bash: mupip: command not found
 
/bin/bash: mupip: command not found
 
/bin/bash: mupip: command not found
 
/bin/bash: mupip: command not found
 
/bin/bash: mupip: command not found
 
/bin/bash: mupip: command not found
 
 
 
GT.M Mumps users on 26-Nov-08 09:52:50
 
 
 
Proc. id Proc. name      PS  Device  Routine            MODE    CPU time
 
-------- --------------- --- -------- --------          -------
 
6744                    T                              -r      00:00:00
 
6849                    T                              -r      00:00:00
 
7014                    T                              -r      00:00:00
 
7120                    T                              -r      00:00:00
 
11728                    S+  pts/1                      -direct  00:00:00
 
11732    Taskman EHR 1  hib                            -direct  00:00:00
 
 
 
Total 6 users.
 
 
 
GTM>h
 

Revision as of 17:51, 23 September 2009

I've changed over to journaling and now have a backup system to a USB drive.

Use the parent posting terminal session to take down the system, then where it has the backup command, instead do:

mupip set -journal="enable,on,before" -region "*"

then bring the system back up as above.

Here is a quickie backup script called nightlybak.sh that is self explanatory in the comments on how to set it up using cron to run every night at 5. This does not require taking down the system. It can be run with or without cron. Remember to chmod +x to make it executable on Linux. Good compression is achievable with this via tar -czf, I was able to get about a 70% file size reduction. No guarantees on this, use at your own risk, has been tested some.

You should encrypt the USB drive prior to backing up to prevent patient data turning up somewhere it should not but right now I do not know how to format a USB drive encrypted and using Linux. Can anyone help with that?

Comments? Thoughts? Rotten tomatoes?

-- IV

              • begin script *******
  1. !/bin/bash
  2. nightlybak.sh
  3. Quickie daily backup, should be run with cron.
  4. Use crontab -e with the follwing in the crontab file:
  5. MAILTO=youremail@somewhere.org
  6. 00 5 * * * /home/vista/EHR/nightlybak.sh
  7. The above crontab will run every day at 5 and will run the script below
  8. if placed in the proper subdirectory. This will create a backup on the primary
  9. machine, tar it and compress it, then copy it to an external media.
  10. It will then email that it has done it.
  11. Caveats: This has very little error-checking for media present and writable.
  12. This has been somewhat tested on Fedora 9 Linux.
  13. No guarantees or warranties expressed or implied, use at your own risk.
  14. Author: Ignacio Valdes, MD, MS
  15. 12/18/08

FN=/home/vista/EHR/g/backup/mumps.dat.bak_$(date +%Y%m%d) TGZFN=/home/vista/EHR/g/backup/mumps.dat.bak_$(date +%Y%m%d).tgz /usr/local/gtm/mupip backup -database -nojournal "*" $FN tar -czf $TGZFN $FN

  1. copy to previously mounted removable media.

cp $TGZFN /media/My\ Book/

  1. Clean up a little bit.

rm $FN

            • End Script ******

All rights reserved - Ignacio Valdes