Command line backup and retry

PowerShell script exchange

Command line backup and retry

Veeam Logoby bteichner » Thu Jun 07, 2012 3:14 pm

One of our backups I'm running from a scheduled task with Veeam.Backup.Manager.exe (for scheduling purposes). The issue that I'm running into though, is if the backup fails it never runs a "retry job" like you can from the VBR console. Is there a way to set the number of retry attempts when initiating a backup job from the command line?
bteichner
Enthusiast
 
Posts: 30
Liked: 2 times
Joined: Mon Apr 30, 2012 5:54 pm
Full Name: Brian Teichner

Re: Command line backup and retry

Veeam Logoby Vitaliy S. » Thu Jun 07, 2012 3:20 pm

This should be possible to do with PowerShell: search.php?st=posts&keywords=retry+job&fid%5B%5D=26
Vitaliy S.
Veeam Software
 
Posts: 19539
Liked: 1097 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: Command line backup and retry

Veeam Logoby bteichner » Thu Jun 07, 2012 4:34 pm

So something like this should work in a powershell script:
Code: Select all
Start-VBRJob JobName -RetryBackup 1


I'd like to continue to use the windows scheduled task I have in place, and call the new powershell script instead.
bteichner
Enthusiast
 
Posts: 30
Liked: 2 times
Joined: Mon Apr 30, 2012 5:54 pm
Full Name: Brian Teichner

Re: Command line backup and retry

Veeam Logoby Sethbartlett » Thu Jun 07, 2012 7:12 pm

Correct, this should work fine.
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me ;)
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
Sethbartlett
Expert
 
Posts: 282
Liked: 25 times
Joined: Wed Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett

Re: Command line backup and retry

Veeam Logoby andrew.proctor » Wed Jun 13, 2012 3:34 pm 2 people like this post

I found this too with powershell. Here's how I got round it - the job will retry 3 times if it fails, waiting 8 minutes between each retry
Code: Select all
$job = Get-VBRJob -name $jobname
$jobtry = 0
start-VBRJob -job $job
if($job.GetLastResult() -eq "Failed"){
    do{
        Start-Sleep 480
        Start-VBRJob -job $job -RetryBackup
        $jobtry++
    }
    while(($jobtry -lt 3) -and ($job.GetLastResult() -eq "Failed"))
}
}


I use it as part of a slightly longer script that chains my jobs together so they run consecutively and it seems to work well. Hope this helps.
andrew.proctor
Lurker
 
Posts: 2
Liked: 2 times
Joined: Thu Mar 22, 2012 1:07 pm
Full Name: Andrew Proctor


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 3 guests