The name of a script file for post-processing of a restoration is as follows.
<Environment directory>\etc\backup\scripts\OpcRestorePost.js
<Shared disk>:\etc\opt\swstorage\etc\backup\scripts\OpcRestorePost.js
1: // AdvancedCopy Manager for Windows 2: // All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2009 3: // 4: // OpcRestorePost.js: Post-Processing Script for swstrestore 5: // 6: // [Parameters] 7: // 1st argument: device name of transaction volume 8: // 9: // [Return Values] 10: // 0: The script ended normally. 11: // 2: The number of the arguments is incorrect. 12: // (3,5): not used, but must not be used because older versions use these values. 13: // 4: An error other than the above occurred. 14: 15: try { 16: // create global objects 17: var WshShell = WScript.CreateObject("WScript.Shell"); // create Shell object 18: var WshEnv = WshShell.Environment("PROCESS"); // create Environment object 19: var fsObj = WScript.CreateObject("Scripting.FileSystemObject"); // create FileSystemObject object 20: 21: // create SwstRestorePostProc object 22: var proc = new SwstRestorePostProc(); 23: 24: // do nothing if postprocessing file exists 25: if (fsObj.FileExists(proc.postFileName) == false) { 26: proc.doNothing(); 27: } 28: // get postprocessing type 29: else { 30: var postProcType = proc.getPostProcType(); 31: switch(postProcType) { 32: case "none": 33: proc.doNothing(); 34: break; 35: } 36: } 37: 38: // clear temporary file 39: proc.deletePostFile(); 40: SwstQuit(0); 41: } catch (e) { 42: SwstQuit(6); 43: } 44: 45: function SwstRestorePostProc() 46: { 47: // member variables 48: this.tvName = WScript.Arguments.length!=1?SwstQuit(1):WScript.Arguments.Item(0); // device name of transaction volume 49: this.postFileName = getDataPathName() + "\\" + getPutFileName(this.tvName) + ".pre"; // name of postprocessing file 50: 51: // member functions 52: this.getPostProcType= getPostProcType; // self-explanatory 53: this.doNothing = doNothing; // self-explanatory 54: this.deletePostFile = deletePostFile; // self-explanatory 55: } 56: 57: function getPostProcType() 58: { 59: var iomode = 1; // means read-only mode 60: var create = false; // means not to create a file 61: var postFileStream = fsObj.OpenTextFile(this.postFileName, iomode, create); 62: var postProc = postFileStream.ReadAll(); 63: postFileStream.Close(); 64: return postProc; 65: } 66: 67: function doNothing() 68: { 69: // do nothing 70: } 71: 72: function deletePostFile() 73: { 74: if (fsObj.FileExists(this.postFileName) == true) { 75: fsObj.DeleteFile(this.postFileName); 76: } 77: } 78: 79: function SwstQuit(exitStatus) 80: { 81: switch(exitStatus) { 82: case 0: 83: WScript.Quit(0); 84: case 1: 85: WScript.Echo("[Restore Postprocessing] The number of the arguments is incorrect."); 86: WScript.Quit(2); 87: default: 88: WScript.Echo("[Restore Postprocessing] The script exited abnormally."); 89: WScript.Quit(4); 90: } 91: } 92: 93: function getDataPathName() 94: { 95: return WshShell.RegRead(getSetupInfoKey() + "\\etcPathName") + "\\etc\\backup\\data\\DEFAULT"; 96: } 97: 98: function getBinPathName() 99: { 100: return WshShell.RegRead(getSetupInfoKey() + "\\PathName") + "\\bin"; 101: } 102: 103: function getSetupInfoKey() 104: { 105: var nodeName = WshEnv.Item("SWSTGNODE"); 106: if( nodeName != "" ){ 107: return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion\\" + nodeName; 108: } 109: return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion"; 110: } 111: 112: function getPutFileName(deviceName){ 113: var fileName; 114: if( isSafeDISKName(deviceName) ){ 115: var re = /(\S+)\/(\S+):(\S+)/; 116: fileName = deviceName.replace(re, "$1_$2_$3"); 117: }else{ 118: fileName = deviceName; 119: } 120: return(fileName); 121: } 122: 123: function getGXDXPX(deviceName){ 124: var gXdXpX; 125: if( isSafeDISKName(deviceName) ){ 126: var re = /(\S+)\/(\S+):(\S+)/; 127: gXdXpX = deviceName.replace(re, "$3"); 128: }else{ 129: gXdXpX = deviceName; 130: } 131: return(gXdXpX); 132: } 133: 134: function isSafeDISKName(deviceName){ 135: var key = ":g"; 136: var s = deviceName.indexOf(key); 137: if ( s < 0 ) { 138: return (false); 139: } else { 140: return (true); 141: } 142: }
Point
The backup volume is locked/unlocked not by the script but by the command. Therefore, the restoration pre-processing and post-processing scripts are executed immediately before and after the backup volume is locked/unlocked.
Note
In the restoration pre-processing, to avoid a temporary access conflict with other applications, locking is retried if it cannot complete its operation. If the number of times the command is executed reaches the specified retry count limit, locking ends abnormally. If an abnormal end occurs, a process that is using the backup-restored volume remains active. Stop all applications and services involved or take other appropriate measures so that the volume cannot be used by another process.
Although the retry count limit can be changed by creating a volume locking specification file and resetting the count limit (for details on the file, refer to "A.3.3 Backup-restored volume locking specification file"), the files do not need to be created if appropriate measures have been taken to prevent other processes from using the target volume during restoration processing execution.