The replication source volume script (RepSrcPre.js) and the replication destination volume script (RepDstPre.js) are prepared for a pre-processing script, and it is stored in the following directory. Please customize these scripts according to the processing requirements.
<Environment directory>\etc\repl\scripts
<Shared disk>:\etc\opt\swstorage\etc\repl\scripts
1: // AdvancedCopy Manager for Windows 2: // All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2009 3: // 4: // RepSrcPre.js: Pre-Processing Script for Replication(Source) 5: // 6: // [Parameters] 7: // 1st argument: device name of source volume 8: // 9: // [Return Values] 10: // 0: The script ended normally. 11: // 2: The number of the arguments is incorrect. 12: // (1,3): unused, but must not be used because older versions use this value. 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 SwstReplicationPreProc object 22: var proc = new SwstReplicationPreProc(); 23: 24: // there is nothing to do if the pre/post-processing is not customized 25: proc.doNothingForDriveLetter(); 26: 27: SwstQuit(0); 28: } catch (e) { 29: SwstQuit(9); 30: } 31: 32: function SwstReplicationPreProc() 33: { 34: // member variables 35: this.svName = WScript.Arguments.length!=1?SwstQuit(1):WScript.Arguments.Item(0); // device name of source volume 36: this.postFileName = getDataPathName() + "\\" + getPutFileName(this.svName) + ".spre"; // name of postprocessing file 37: 38: // member functions 39: this.doNothingForDriveLetter = doNothingForDriveLetter; // self-explanatory 40: this.writePostFile = writePostFile; // self-explanatory 41: } 42: 43: function doNothingForDriveLetter() 44: { 45: this.writePostFile(this.postFileName, "none"); 46: } 47: 48: function writePostFile(postfile, postdata) 49: { 50: var overwrite = true; // means to overwrite a file if it exists. 51: var postFileStream = fsObj.CreateTextFile(postfile, overwrite); 52: postFileStream.WriteLine(postdata); 53: postFileStream.Close(); 54: } 55: 56: function SwstQuit(exitStatus) 57: { 58: switch(exitStatus) { 59: case 0: 60: WScript.Quit(0); 61: case 1: 62: WScript.Echo("[Replication Preprocessing] The number of the arguments is incorrect."); 63: WScript.Quit(2); 64: default: 65: WScript.Echo("[Replication Preprocessing] The script exited abnormally."); 66: WScript.Quit(4); 67: } 68: } 69: 70: function getDataPathName() 71: { 72: return WshShell.RegRead(getSetupInfoKey() + "\\etcPathName") + "\\etc\\repl\\data\\DEFAULT"; 73: } 74: 75: function getBinPathName() 76: { 77: return WshShell.RegRead(getSetupInfoKey() + "\\PathName") + "\\bin"; 78: } 79: 80: function getSetupInfoKey() 81: { 82: var nodeName = WshEnv.Item("SWSTGNODE"); 83: if( nodeName != "" ){ 84: return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion\\" + nodeName; 85: } 86: return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion"; 87: } 88: 89: function getPutFileName(deviceName){ 90: var fileName; 91: if( isSafeDISKName(deviceName) ){ 92: var re = /(\S+)\/(\S+):(\S+)/; 93: fileName = deviceName.replace(re, "$1_$2_$3"); 94: }else{ 95: fileName = deviceName; 96: } 97: return(fileName); 98: } 99: 100: function getGXDXPX(deviceName){ 101: var gXdXpX; 102: if( isSafeDISKName(deviceName) ){ 103: var re = /(\S+)\/(\S+):(\S+)/; 104: gXdXpX = deviceName.replace(re, "$3"); 105: }else{ 106: gXdXpX = deviceName; 107: } 108: return(gXdXpX); 109: } 110: 111: function isSafeDISKName(deviceName){ 112: var key = ":g"; 113: var s = deviceName.indexOf(key); 114: if ( s < 0 ) { 115: return (false); 116: } else { 117: return (true); 118: } 119: }
1: // AdvancedCopy Manager for Windows 2: // All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2009 3: // 4: // RepDstPre.js: Pre-Processing Script for Replication(Destination) 5: // 6: // [Parameters] 7: // 1st argument: device name of destination volume 8: // 9: // [Return Values] 10: // 0: The script ended normally. 11: // 2: The number of the arguments is incorrect. 12: // (1,3): unused, 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 SwstReplicationPreProc object 22: var proc = new SwstReplicationPreProc(); 23: 24: // there is nothing to do if the pre/post-processing is not customized 25: proc.doNothingForDriveLetter(); 26: 27: SwstQuit(0); 28: } catch (e) { 29: SwstQuit(9); 30: } 31: 32: function SwstReplicationPreProc() 33: { 34: // member variables 35: this.dvName = WScript.Arguments.length!=1?SwstQuit(1):WScript.Arguments.Item(0); // device name of destination volume 36: this.postFileName = getDataPathName() + "\\" + getPutFileName(this.dvName) + ".dpre"; // name of postprocessing file 37: 38: // member functions 39: this.doNothingForDriveLetter = doNothingForDriveLetter; // self-explanatory 40: this.writePostFile = writePostFile; // self-explanatory 41: } 42: 43: function doNothingForDriveLetter() 44: { 45: this.writePostFile(this.postFileName, "none"); 46: } 47: 48: function writePostFile(postfile, postdata) 49: { 50: var overwrite = true; // means to overwrite a file if it exists. 51: var postFileStream = fsObj.CreateTextFile(postfile, overwrite); 52: postFileStream.WriteLine(postdata); 53: postFileStream.Close(); 54: } 55: 56: function SwstQuit(exitStatus) 57: { 58: switch(exitStatus) { 59: case 0: 60: WScript.Quit(0); 61: case 1: 62: WScript.Echo("[Replication Preprocessing] The number of the arguments is incorrect."); 63: WScript.Quit(2); 64: default: 65: WScript.Echo("[Replication Preprocessing] The script exited abnormally."); 66: WScript.Quit(4); 67: } 68: } 69: 70: function getDataPathName() 71: { 72: return WshShell.RegRead(getSetupInfoKey() + "\\etcPathName") + "\\etc\\repl\\data\\DEFAULT"; 73: } 74: 75: function getBinPathName() 76: { 77: return WshShell.RegRead(getSetupInfoKey() + "\\PathName") + "\\bin"; 78: } 79: 80: function getSetupInfoKey() 81: { 82: var nodeName = WshEnv.Item("SWSTGNODE"); 83: if( nodeName != "" ){ 84: return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion\\" + nodeName; 85: } 86: return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion"; 87: } 88: 89: function getPutFileName(deviceName){ 90: var fileName; 91: if( isSafeDISKName(deviceName) ){ 92: var re = /(\S+)\/(\S+):(\S+)/; 93: fileName = deviceName.replace(re, "$1_$2_$3"); 94: }else{ 95: fileName = deviceName; 96: } 97: return(fileName); 98: } 99: 100: function getGXDXPX(deviceName){ 101: var gXdXpX; 102: if( isSafeDISKName(deviceName) ){ 103: var re = /(\S+)\/(\S+):(\S+)/; 104: gXdXpX = deviceName.replace(re, "$3"); 105: }else{ 106: gXdXpX = deviceName; 107: } 108: return(gXdXpX); 109: } 110: 111: function isSafeDISKName(deviceName){ 112: var key = ":g"; 113: var s = deviceName.indexOf(key); 114: if ( s < 0 ) { 115: return (false); 116: } else { 117: return (true); 118: } 119: }