Comprehensive data protection for all workloads
Post Reply
D_Codling
Lurker
Posts: 1
Liked: never
Joined: Dec 07, 2010 11:02 pm
Full Name: Danny Codling
Contact:

Post Job Command, Success Only, Tape Backup

Post by D_Codling »

Hi everyone, hopefully this is a simple one :-D

Does the post job command run only if the backup job is successful? The reason I ask is that each day, during our daily checks, I have to check the Veeam job and the subsequent Backup Exec job that runs via the post job command. I'm hoping that the post job command is only invoked after a successful backup from Veeam thus during my daily checks, if the backup exec job ran, the Veeam job can be assumed to be successful (I have individual Veeam/Backup Exec jobs for each VM guest). It's not much, but hopefully it will save a little time with the dull admin function of my job!

Thanks in advance,


Danny
Gostev
Chief Product Officer
Posts: 31804
Liked: 7298 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: Post Job Command, Success Only, Tape Backup

Post by Gostev »

Hi Danny, the command will run every time, however you can easily query last job result with PowerShell script via GetLastResult().

The following script will run selected EXE file passing path to the latest Veeam backup file as an argument (but only as long as the job was successful). It will also set archive bit on every Veeam backup file processed to prevent it from being archived to tape more than once.

Code: Select all

Add-PSSnapin VeeamPSSnapIn

$jobName = "Put Backup Job Name Here"

if ((Get-VBRJob | where {$_.Name -eq $jobName}).GetLastResult() -eq "Success")
{
   $latestOib = Get-VBRBackup | where {$_.JobName -eq $jobName} | Get-VBRRestorePoint | sort CreationTime -Descending | select -First 1
   $latestOib
   $storage = $latestOib.GetStorage()
   $storage.FilePath

   $file = get-item $storage.FilePath
   if ($file.Attributes -band ([System.IO.FileAttributes]::Archive))
   {
     path_to_tape_backup_exe $storage.FilePath
     
      $file.Attributes = ($file.Attributes -bxor [System.IO.FileAttributes]::Archive)
   } 
}
Hope this helps!
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 113 guests