サポートと今すぐチャット
サポートとのチャット

Rapid Recovery 6.3 - Command Line and Scripting Reference Guide

Rapid Recovery overview and system requirements Command Line Management Utility PowerShell Module
Prerequisites for using PowerShell Working with commands and cmdlets Rapid Recovery PowerShell module cmdlets
Add-CredentialsVaultAccount AddEncryptionKeytoProtectedMachine Add-EsxAutoProtectObjects Add-EsxVirtualMachines Add-HyperVClusterSharedVirtualDisks Add-HyperVClusterVirtualMachines Add-HyperVVirtualMachines Disable-HyperVAutoProtection Edit-ActiveBlockMapping Edit-AzureVirtualStandby Edit-EsxiVirtualStandby Edit-EsxServerProtectionRules Edit-ExcludedFilesAndFolders Edit-HyperVClusterProtectionRules Edit-HyperVServerProtectionRules Edit-HyperVVirtualStandby Edit-OracleDBVerifyNightlyJob Edit-OracleLogTruncationNightlyJob Edit-Replication Edit-ScheduledArchive Edit-VBVirtualStandby Edit-VMVirtualStandby Enable-HyperVAutoProtection Enable-OracleArchiveLogMode Get-ActiveJobs Get-CloudAccounts Get-Clusters Get-CompletedJobs Get-CredentialsVaultAccounts Get-ExchangeMailStores Get-Failed Get-FailedJobs Get-HyperVClusterSharedVirtualDisks Get-ListAzureVMSizes Get-Mounts Get-OracleInstanceMetadata Get-OracleInstances Get-Passed Get-ProtectedServers Get-ProtectionGroups Get-ProtectionRules Get-QueuedJobs Get-RecoveryPoints Get-ReplicatedServers Get-Repositories Get-ScheduledArchives Get-SqlDatabases Get-TransferQueueEntries Get-UnprotectedVolumes Get-Version Get-VirtualizedServers Get-Volumes Join-CredentialsVaultAccount New-AzureVirtualStandby New-Base New-BootCD New-CloudAccount New-EncryptionKey New-EsxiVirtualStandby New-FileSearch New-HyperVVirtualStandby New-Mount New-Replication New-Repository New-ScheduledArchive New-Snapshot New-VBVirtualStandby New-VMVirtualStandby Open-DvmRepository Push-Replication Push-Rollup Remove-Agent Remove-CredentialsVaultAccount Remove-EncryptionKey Remove-EsxAutoProtectObjects Remove-EsxVirtualMachines Remove-HyperVClusterSharedVirtualDisks Remove-HyperVClusterVirtualMachines Remove-HyperVVirtualMachines Remove-Mount Remove-Mounts Remove-RecoveryPoints Remove-Replication Remove-Repository Remove-ScheduledArchive Remove-VirtualStandby Restart-CoreService Resume-Replication Resume-ScheduledArchive Resume-Scheduler Resume-Snapshot Resume-VirtualStandby Set-AgentMetadataCredentials Set-CredentialsVaultAccount Set-DedupCacheConfiguration Set-License Set-OracleMetadataCredentials Set-ReplicationResponse Start-Archive Start-AttachabilityCheck Start-AzureDeploy Start-AzureExport Start-BackupSettings Start-ChecksumCheck Start-ConfigureAgentMigration Start-ConsumeSeedDrive Start-CopySeedDrive Start-EsxiExport Start-HypervExport Start-LogTruncation Start-MountabilityCheck Start-OptimizationJob Start-OracleDBVerifyJob Start-OracleLogTruncationJob Start-Protect Start-ProtectCluster Start-ProtectEsxServer Start-ProtectHyperVCluster Start-ProtectHyperVServer Start-RepositoryCheck Start-RestoreAgent Start-RestoreArchive Start-RestoreSettings Start-RestoreUrc Start-ScheduledArchive Start-VBExport Start-VirtualStandby Start-VMExport Stop-ActiveJobs Stop-CoreService Suspend-Replication Suspend-ScheduledArchive Suspend-Scheduler Suspend-Snapshot Suspend-VirtualStandby Update-Repository
Localization Qualifiers
Scripting

PostNightlyJobScript.ps1

The PostNightlyJobScript is run after every nightly job on the Core. It contains the parameter $JobClassName, which helps to handle those child jobs separately.

Sample PostNightlyJobScript

# receiving parameters from Nightlyjob
param([System.String]$JobClassMethod , [object]$NightlyAttachabilityJobRequest, 
[object]$RollupJobRequest, [object]$Agents, [object]$ChecksumCheckJobRequest, [object]$TransferJobRequest, 
[int]$LatestEpochSeenByCore, [object]$TakeSnapshotResponse)
# building path to Core's Common.Contracts.dll and loading this assembly
$regLM = [Microsoft.Win32.Registry]::LocalMachine
$regLM = $regLM.OpenSubKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\AppRecovery Core 5')
$regVal = $regLM.GetValue('InstallLocation')
$regVal = $regVal + 'CoreService\Common.Contracts.dll'
[System.Reflection.Assembly]::LoadFrom($regVal)  |  out-null
$regVal2 = $regLM.GetValue('InstallLocation')
$regVal2= $regVal2 + 'CoreService\Core.Contracts.dll'
[System.Reflection.Assembly]::LoadFrom($regVal2) | out-null
# Nightlyjob has four child jobs: NightlyAttachability Job, Rollup Job, 
# Checksum Check Job and Log Truncation Job. All of them are triggering the script,
# and $JobClassMethod (contains job name that calls the script) helps to handle those
# child jobs separately
switch ($JobClassMethod) {
# working with NightlyAttachability Job
   NightlyAttachabilityJob {
    $NightlyAttachabilityJobRequestObject = $NightlyAttachabilityJobRequest -as 
    [Replay.Core.Contracts.Sql.NightlyAttachabilityJobRequest];
       echo 'Nightly Attachability job results:';
          if($NightlyAttachabilityJobRequestObject -eq $null) {
             echo 'NightlyAttachabilityJobRequestObject parameter is null';
          }
          else {
             echo 'AgentIds:' $NightlyAttachabilityJobRequestObject.AgentIds;
             echo 'IsNightlyJob:' $NightlyAttachabilityJobRequestObject.IsNightlyJob;
       }
          break;
   }
# working with Rollup Job
  RollupJob {
    $RollupJobRequestObject = $RollupJobRequest -as 
    [Replay.Core.Contracts.Rollup.RollupJobRequest];
      echo 'Rollup job results:';
         if($RollupJobRequestObject -eq $null) {
            echo 'RollupJobRequestObject parameter is null';
            }
         else {
            echo 'AgentIds:' $RollupJobRequestObject.AgentIds;
            echo 'IsNightlyJob:' $RollupJobRequestObject.IsNightlyJob;
         }
   $AgentsCollection = $Agents -as "System.Collections.Generic.List``1[System.Guid]"
     if($AgentsCollection -eq $null) {
        echo 'AgentsCollection parameter is null';
        }
     else {
        echo 'Agents GUIDs:'
            foreach ($a in $AgentsCollection) {
               echo $a
               }
            }
        break;
   }
# working with Checksum Check Job
   ChecksumCheckJob {
	$ChecksumCheckJobRequestObject = $ChecksumCheckJobRequest -as 
	[Replay.Core.Contracts.Exchange.ChecksumChecks.ChecksumCheckJobRequest];
	  echo 'Exchange checksumcheck job results:';
	     if($ChecksumCheckJobRequestObject -eq $null) {
	        echo 'ChecksumCheckJobRequestObject parameter is null';
	        }
	     else {
	        echo 'RecoveryPointId:' $ChecksumCheckJobRequestObject.RecoveryPointId;
	        echo 'AgentIds:' $ChecksumCheckJobRequestObject.AgentIds;
	        echo 'IsNightlyJob:' $ChecksumCheckJobRequestObject.IsNightlyJob;
	     }
	     break;
   }
# working with Log Truncation Job
  TransferJob {
    $TransferJobRequestObject = $TransferJobRequest -as 
    [Replay.Core.Contracts.Transfer.TransferJobRequest];
       echo 'Transfer job results:';
          if($TransferJobRequestObject -eq $null) {
             echo 'TransferJobRequestObject parameter is null';
          }
          else {
             echo 'TransferConfiguration:' $TransferJobRequestObject.TransferConfiguration;
             echo 'StorageConfiguration:' $TransferJobRequestObject.StorageConfiguration;
          }
       echo 'LatestEpochSeenByCore:' $LatestEpochSeenByCore;
       $TakeSnapshotResponseObject = $TakeSnapshotResponse -as 
       [Replay.Agent.Contracts.Transfer.TakeSnapshotResponse];
         if($TakeSnapshotResponseObject -eq $null) {
             echo 'TakeSnapshotResponseObject parameter is null';
          }
         else {
             echo 'ID of this transfer session:' $TakeSnapshotResponseObject.SnapshotSetId;
             echo 'Volumes:' $TakeSnapshotResponseObject.VolumeSnapshots;
         }
         break;
   }
}

Using Bourne shell and Bash scripting with Rapid Recovery

Bourne shell (sh) is a shell language or command-line interpreter for Unix-based operating systems. Bourne shell is used in Rapid Recovery with Linux to customize environments and specify certain operations to occur in a predetermined sequence. The .sh is the file extension and naming convention for Bourne shell files.

Bourne Again Shell (Bash) is a similar shell language that implements the same grammar, parameter, and variable expansion, redirection and quoting. Bash also uses the same .sh file extension. The information here applies equally to Bash.

Using pre- and post-transfer, pre- and post-snapshot, and post-export script hooks, you can perform system operations before and after a transfer or snapshot, or after virtual export. For example, you may want to disable a certain cronjob while a transfer is occurring and enable it once the transfer has finished. As another example, you may need to run commands to flush application-specific data to disk. The contents are written to a temporary file and run using exec. The script then runs using the interpreter defined in the first line of the script, for example, (#!/usr/bin/env bash). If the specified interpreter is not available, the script uses the default shell defined in the $SHELL environment variable.

You can substitute and use any interpreter. For example, on the #! line of the script, you can replace “bash” with “zsh” (Z shell), “tcsh” (tee shell), and so on, based on your preference.

You can add available objects from the TransferPrescript parameter or add your own commands to the PreTransferScript.sh and PostTransfer.sh scripts to customize them.

Only PreTransferScript and PostTransferScript receive parameters. The snapshot and export scripts do not.

This section describes the scripts that administrators can use at designated occurrences in Rapid Recovery for Windows and Linux. It includes the following topics:

Prerequisites for shell scripting

Rapid Recovery provides the ability to run Bourne shell, Bash, and other shell scripts on a protected Linux machine before and after a transfer. The following scripts are supported for Linux machines protected with the Rapid Recovery Agent software.

NOTE: If a script is not executable, the transfer job fails.

  • PreTransferScript.sh
  • PostTransferScript.sh
  • PreSnapshotScript.sh
  • PostSnapshotScript.sh
  • PostExportScript.sh

To use these scripts, ensure that they reside in the /opt/apprecovery/scripts/ directory.

Execution timing for pre- and post- scripts

For context, the following diagram shows the difference in timing for running pre- and post-transfer and snapshot scripts.

When pre- and post- scripts execute

When pre and post scripts execute

Supported transfer and post-transfer script parameters

The following parameters are supported on Linux for transfer scripts. For more information, see Sample shell scripts.

  • TransferPrescriptParameter_VolumeNames=$TransferPrescriptParameter_VolumeNames
  • TransferPrescriptParameter_ShadowCopyType=$TransferPrescriptParameter_ShadowCopyType
  • TransferPrescriptParameter_TransferConfiguration=$TransferPrescriptParameter_TransferConfiguration
  • TransferPrescriptParameter_StorageConfiguration=$TransferPrescriptParameter_StorageConfiguration
  • TransferPrescriptParameter_Key=$TransferPrescriptParameter_Key
  • TransferPrescriptParameter_ForceBaseImage=$TransferPrescriptParameter_ForceBaseImage
  • TransferPrescriptParameter_IsLogTruncation=$TransferPrescriptParameter_IsLogTruncation
  • TransferPrescriptParameter_LatestEpochSeenByCore=$TransferPrescriptParameter_LatestEpochSeenByCore

The following parameters are supported on Linux for post transfer scripts.

  • TransferPostscriptParameter_VolumeNames=$TransferPostscriptParameter_VolumeNames
  • TransferPostscriptParameter_ShadowCopyType=$TransferPostscriptParameter_ShadowCopyType
  • TransferPostscriptParameter_TransferConfiguration=$TransferPostscriptParameter_TransferConfiguration
  • TransferPostscriptParameter_StorageConfiguration=$TransferPostscriptParameter_StorageConfiguration
  • TransferPostscriptParameter_Key=$TransferPostscriptParameter_Key
  • TransferPostscriptParameter_ForceBaseImage=$TransferPostscriptParameter_ForceBaseImage
  • TransferPostscriptParameter_IsLogTruncation=$TransferPostscriptParameter_IsLogTruncation
  • TransferPostscriptParameter_LatestEpochSeenByCore=$TransferPostscriptParameter_LatestEpochSeenByCore

Testing shell scripting

You can test the scripts you want to run by using the editor for the script (.sh) files.

NOTE: If the pre- or post- script fails, the job also fails. Information about the job is available in the /var/log/apprecovery/apprecovery.log file.
 Successful scripts return the exit code 0.

Input parameters for shell scripting

The parameters for shell scripting in Rapid Recovery are described in the following tables.

TransferPrescriptParameters_VolumeNames

The following table presents the available objects for the TransferPrescript parameter.

Table 232: TransferPrescript objects
Method Description
public VolumeNameCollection VolumeNames (get; set; ) Gets or sets the collection of volume names for transfer.

VolumeNames is a data structure that contains the following data:

  • GuidName. The Guid associated with the volume, used as the name if a DisplayName is not set.
  • DisplayName. The displayed name of the volume.
public ShadowCopyType ShadowCopyType { get; set; } Gets or sets the type of copying for transfer. ShadowCopyType is an enumeration with values. The available values are:
  • Unknown
  • Copy
  • Full
public string Key { get; set; } The Key method generates a pseudorandom (but not cryptographically secure) key, which can be used as a one-time password to authenticate transfer requests.
public bool ForceBaseImage { get; set; } Gets or sets the value indicating whether the transfer was a forced base image capture.
public bool IsLogTruncation { get; set; } Gets or sets the value indicating whether logging is being truncated.
public uint LatestEpochSeenByCore { get; set; } Gets or sets latest epoch value.

The LatestEpochSeenByCore method is the ordinal number of the most recent snapshot taken by the Core. This is the 'epoch number' assigned by the filter driver to this particular snapshot at the moment it was taken with VSS.

TransferPostscriptParameter

The following table presents the available objects for the TransferPostscript parameter.

Table 233: TransferPostscript objects
Method Description
public VolumeNameCollection VolumeNames (get; set; ) Gets or sets the collection of volume names for transfer.

VolumeNames is a data structure that contains the following data:

  • GuidName. The Guid associated with the volume, used as the name if a DisplayName is not set.
  • DisplayName. The displayed name of the volume.
public ShadowCopyType ShadowCopyType { get; set; } Gets or sets the type of copying for transfer.ShadowCopyType is an enumeration with values. The available values are:
  • Unknown
  • Copy
  • Full
public string Key { get; set; } The Key method generates a pseudorandom (but not cryptographically secure) key, which can be used as a one-time password to authenticate transfer requests.
public bool ForceBaseImage { get; set; } Gets or sets the value indicating whether the transfer was a forced base image capture.
public bool IsLogTruncation { get; set; } Gets or sets the value indicating whether logging is being truncated.
public uint LatestEpochSeenByCore { get; set; } Gets or sets latest epoch value.

The LatestEpochSeenByCore method is the ordinal number of the most recent snapshot taken by the Core. This is the 'epoch number' assigned by the filter driver to this particular snapshot at the moment it was taken with VSS.

Sample shell scripts

This section describes the sample shell scripts available for administrative users to run on protected machines.

Caution: The sample scripts provided in this document function as they exist when run by qualified administrators. Take precautions when modifying functioning scripts to retain working versions. Any modifications to the script samples included here, or any scripts you create, are considered customization, which is not typically covered by Quest Support.

 

NOTE: Protected machines use the 'exec' shell command to launch the script. You can indicate which interpreter should run the script by defining that information in the first line of the script. If you do not specify the interpreter, the default shell interprets the script. If you choose something other than the default shell, you must ensure that the specified interpreter is available on all protected machines. All sample shell scripts in this document are tested and run successfully as Bourne shell or Bash scripts.

The sample scripts for protected machines include:

関連ドキュメント

The document was helpful.

評価を選択

I easily found the information I needed.

評価を選択