バックアップ実行時の前処理スクリプトは、以下のとおりです。
クラスタ運用でない場合
<環境設定ディレクトリ>\etc\backup\scripts\OpcBackupPre.js |
クラスタ運用の場合
<共有ディスク>:\etc\opt\swstorage\etc\backup\scripts\OpcBackupPre.js |
バックアップ時の前処理スクリプト
1: // AdvancedCopy Manager for Windows 2: // All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2006 3: // 4: // OpcBackupPre.js: Pre-Processing Script for swstbackup 5: // 6: // [Parameters] 7: // 1st argument: device name of transaction volume 8: // 2nd argument: device name of backup volume 9: // 10: // [Return Values] 11: // 0: The script ended normally. 12: // 2: The number of the arguments is incorrect. 13: // (2-3): not used, but must not be used because older versions use these values. 14: // 4: An error other than the above occurred. 15: 16: try { 17: // create global objects 18: var WshShell = WScript.CreateObject("WScript.Shell"); // create Shell object 19: var WshEnv = WshShell.Environment("PROCESS"); // create Environment object 20: var fsObj = WScript.CreateObject("Scripting.FileSystemObject"); // create FileSystemObject object 21: 22: // create SwstBackupPreProc object 23: var proc = new SwstBackupPreProc(); 24: 25: // there is nothing to do if the pre/post-processing is not customized 26: proc.doNothingForDriveLetter(); 27: 28: // if a backup volume is specified, .bd file is created. 29: if (proc.bvName.length != 0) { 30: proc.writePostFile(proc.bdFileName, proc.bvName); 31: } 32: SwstQuit(0); 33: } catch (e) { 34: SwstQuit(4); 35: } 36: 37: function SwstBackupPreProc() 38: { 39: // member variables 40: this.tvName = WScript.Arguments.length!=2?SwstQuit(1):WScript.Arguments.Item(0); // device name of transaction volume 41: this.postFileName = getDataPathName() + "\\" + getPutFileName(this.tvName) + ".pre"; // name of postprocessing file 42: this.bvName = WScript.Arguments.Item(1); // device name of transaction volume 43: this.bdFileName = getDataPathName() + "\\" + getPutFileName(this.tvName) + ".bd"; // name of postprocessing file 44: 45: // member functions 46: this.doNothingForDriveLetter = doNothingForDriveLetter; // self-explanatory 47: this.writePostFile = writePostFile; // self-explanatory 48: } 49: 50: function doNothingForDriveLetter() 51: { 52: this.writePostFile(this.postFileName, "none"); 53: } 54: 55: function writePostFile(postfile, postdata) 56: { 57: var overwrite = true; // means to overwrite a file if it exists. 58: var postFileStream = fsObj.CreateTextFile(postfile, overwrite); 59: postFileStream.Write(postdata); 60: postFileStream.Close(); 61: } 62: 63: function SwstQuit(exitStatus) 64: { 65: switch(exitStatus) { 66: case 0: 67: WScript.Quit(0); 68: case 1: 69: WScript.Echo("[Backup Preprocessing] The number of the arguments is incorrect."); 70: WScript.Quit(2); 71: default: 72: WScript.Echo("[Backup Preprocessing] The script exited abnormally."); 73: WScript.Quit(4); 74: } 75: } 76: 77: function getDataPathName() 78: { 79: return WshShell.RegRead(getSetupInfoKey() + "\\etcPathName") + "\\etc\\backup\\data\\DEFAULT"; 80: } 81: 82: function getBinPathName() 83: { 84: return WshShell.RegRead(getSetupInfoKey() + "\\PathName") + "\\bin"; 85: } 86: 87: function getSetupInfoKey() 88: { 89: var nodeName = WshEnv.Item("SWSTGNODE"); 90: if( nodeName != "" ){ 91: return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion\\" + nodeName; 92: } 93: return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion"; 94: } 95: 96: function getPutFileName(deviceName){ 97: var fileName; 98: if( isSafeDISKName(deviceName) ){ 99: var re = /(\S+)\/(\S+):(\S+)/; 100: fileName = deviceName.replace(re, "$1_$2_$3"); 101: }else{ 102: fileName = deviceName; 103: } 104: return(fileName); 105: } 106: 107: function getGXDXPX(deviceName){ 108: var gXdXpX; 109: if( isSafeDISKName(deviceName) ){ 110: var re = /(\S+)\/(\S+):(\S+)/; 111: gXdXpX = deviceName.replace(re, "$3"); 112: }else{ 113: gXdXpX = deviceName; 114: } 115: return(gXdXpX); 116: } 117: 118: function isSafeDISKName(deviceName){ 119: var key = ":g"; 120: var s = deviceName.indexOf(key); 121: if ( s < 0 ) { 122: return (false); 123: } else { 124: return (true); 125: } 126: } |