Top
ETERNUS SFAdvancedCopy Manager 14.0 Operator's Guide forTape Server Option

A.4.10 Tape copy post-processing in Windows

The names of the post-processing script files used for tape copying are as follows:

Content of shell script

  1: // AdvancedCopy Manager for Windows
  2: // All Rights Reserved, Copyright FUJITSU LIMITED, 2005-2007
  3: //
  4: // TapeCopyPost.js: Post-Processing Script for tape copy
  5: //
  6: // [Parameters]
  7: // 1st argument: device name of backup volume
  8: //
  9: // [Return Values]
 10: // 0: The script ended normally.
 11: // 2: The number of the arguments is incorrect.
 12: // 4: An error other than the above occurred.
 13: 
 14: try {
 15:     // create global objects
 16:     var WshShell = WScript.CreateObject("WScript.Shell");              // create Shell object
 17:     var WshEnv = WshShell.Environment("PROCESS");                      // create Environment object
 18:     var fsObj    = WScript.CreateObject("Scripting.FileSystemObject"); // create FileSystemObject object
 19: 
 20:     // create SwstTapeCopyPostProc object
 21:     var proc = new SwstTapeCopyPostProc();
 22: 
 23:     // do nothing if postprocessing file exists
 24:     if (fsObj.FileExists(proc.postFileName) == false) {
 25:         SwstQuit(0);
 26:     }
 27: 
 28:     // get postprocessing type
 29:     var postProcType = proc.getPostProcData(proc.postFileName);
 30:     switch(postProcType) {
 31:     case "none":
 32:         proc.doNothing();
 33:         break;
 34:     }
 35: 
 36:     // clear temporary files
 37:     proc.deletePostFile(proc.postFileName);
 38:     SwstQuit(0);
 39: } catch (e) {
 40:     SwstQuit(6);
 41: }
 42: 
 43: function SwstTapeCopyPostProc()
 44: {
 45:     // member variables
 46:     this.bvName       = WScript.Arguments.length!=1?SwstQuit(1):WScript.Arguments.Item(0); // device name of transaction volume
 47:     this.postFileName = getDataPathName() + "\\" + getPutFileName(this.bvName) + ".pre";   // name of postprocessing file
 48: 
 49:     // member functions
 50:     this.getPostProcData     = getPostProcData;             // self-explanatory
 51:     this.doNothing           = doNothing;                   // self-explanatory
 52:     this.deletePostFile      = deletePostFile;              // self-explanatory
 53: }
 54: 
 55: function getPostProcData(postfile)
 56: {
 57:     var iomode = 1;     // means read-only mode
 58:     var create = false; // means not to create a file
 59:     var postFileStream = fsObj.OpenTextFile(postfile, iomode, create);
 60:     var postData = postFileStream.ReadAll();
 61:     postFileStream.Close();
 62:     return postData;
 63: }
 64: 
 65: function doNothing()
 66: {
 67:     // do nothing
 68: }
 69: 
 70: function deletePostFile(postfile)
 71: {
 72:     if (fsObj.FileExists(postfile) == true) {
 73:         fsObj.DeleteFile(postfile);
 74:     }
 75: }
 76: 
 77: function SwstQuit(exitStatus)
 78: {
 79:     switch(exitStatus) {
 80:     case 0:
 81:         WScript.Quit(0);
 82:     case 1:
 83:         WScript.Echo("[Tape copy Post-processing] The number of the arguments is incorrect.");
 84:         WScript.Quit(2);
 85:     default:
 86:         WScript.Echo("[Tape copy Post-processing] The script exited abnormally.");
 87:         WScript.Quit(4);
 88:     }
 89: }
 90: 
 91: function getDataPathName()
 92: {
 93:     return WshShell.RegRead(getSetupInfoKey() + "\\etcPathName") + "\\etc\\backup\\data\\DEFAULT";
 94: }
 95: 
 96: function getSetupInfoKey()
 97: {
 98:     var nodeName = WshEnv.Item("SWSTGNODE");
 99:     if( nodeName != "" ){
100:         return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion\\" + nodeName;
101:     }
102:     return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion";
103: }
104: 
105: function getPutFileName(deviceName){
106:     var fileName;
107:     fileName = deviceName;
108:     return(fileName);
109: }

Point

The backup volume is locked and unlocked by programs, not scripts. This means that the tape copy pre-processing script is executed immediately before the volume is locked, and the tape copy post-processing script is executed immediately after the volume is unlocked. The pre-processing and post-processing scripts for tape copying do not perform any actual processing.

Figure A.1 Relationship between backup volume locking/unlocking and pre-processing and post-processing of the script

Note

If, during tape copy pre-processing, the locking process fails because of the need to avoid a temporary access conflict with another application, the locking process will be retried. If the specified number of retries is exceeded, the command terminates abnormally. This indicates that one or more processes are still using the backup volume. The user should take appropriate measures such as terminating applications or services to prevent the volume from being used by other processes. Note that the specified number of retries can be changed by creating a setup file called a "backup volume lock specification file". (Refer to "A.4.11 Backup volume lock specification file for tape copying in Windows" for details.)

Note that if the measures to prevent other processes from using the target volume are correctly implemented while the tape copying process is being performed, there is usually no need to create this file.