-
- Influencer
- Posts: 11
- Liked: 1 time
- Joined: Aug 04, 2015 8:13 am
- Full Name: Michael Custance
- Contact:
Tape Job Priority / Backup Pause script
Case # 00981414
Opened a ticket with support regarding this, but they said I should open a feature request.
Issue we are facing is that our backup copy to tape takes a while to complete. By default Veeam will prioritise the backup o disk and kill the backup to tape job if it is running. We have a 1:1 relationship with regards to the backup to disk and backup to tape jobs, so its fairly simple in that respect.
The backups to tape are only run every fortnight which makes scheduling them around the disk jobs a bit tricky. I could just set the disk jobs to not run on the day we are running the tape jobs, but with the current scheduling options this means missing out on disk backup one day every single week, rather than just once per fortnight.
The two solutions I can think off are
1. Run a pre and post script on the tape backup job which disables the disk backup job when the tape job starts and then enables it again at the end
2. Run a pre script on the disk job which checks to see if the tape job is running and causes a pause for X time and then checks again before allowing the disk job to start
I am thinking option 1 is going to be the easiest approach as are certain we can at least schedule the tape backup job to start when the disk job isn't running.
I just really want to check I am not overthinking this, is there an easier solution?
Opened a ticket with support regarding this, but they said I should open a feature request.
Issue we are facing is that our backup copy to tape takes a while to complete. By default Veeam will prioritise the backup o disk and kill the backup to tape job if it is running. We have a 1:1 relationship with regards to the backup to disk and backup to tape jobs, so its fairly simple in that respect.
The backups to tape are only run every fortnight which makes scheduling them around the disk jobs a bit tricky. I could just set the disk jobs to not run on the day we are running the tape jobs, but with the current scheduling options this means missing out on disk backup one day every single week, rather than just once per fortnight.
The two solutions I can think off are
1. Run a pre and post script on the tape backup job which disables the disk backup job when the tape job starts and then enables it again at the end
2. Run a pre script on the disk job which checks to see if the tape job is running and causes a pause for X time and then checks again before allowing the disk job to start
I am thinking option 1 is going to be the easiest approach as are certain we can at least schedule the tape backup job to start when the disk job isn't running.
I just really want to check I am not overthinking this, is there an easier solution?
-
- Veteran
- Posts: 7328
- Liked: 781 times
- Joined: May 21, 2014 11:03 am
- Full Name: Nikita Shestakov
- Location: Prague
- Contact:
Re: Tape Job Priority / Backup Pause script
Hello Michael,
Indeed backup jobs have a priority over backup-to-tape since making initial backup is more important than to copy existing backup file in general.
There is not much information about your particular situation in the support case, could you specify it, please? What backup jobs do you use, how often, what is the backup method?
Besides the workarounds you described, you can use backup windows to avoid overlapping and schedule the jobs to run not in a specific time, but once another job is finished.
Thanks!
Indeed backup jobs have a priority over backup-to-tape since making initial backup is more important than to copy existing backup file in general.
There is not much information about your particular situation in the support case, could you specify it, please? What backup jobs do you use, how often, what is the backup method?
Besides the workarounds you described, you can use backup windows to avoid overlapping and schedule the jobs to run not in a specific time, but once another job is finished.
Thanks!
-
- Influencer
- Posts: 11
- Liked: 1 time
- Joined: Aug 04, 2015 8:13 am
- Full Name: Michael Custance
- Contact:
Re: Tape Job Priority / Backup Pause script
Would be nice to have the option to say which job would have priority. If we were taking the backups off to tape once per week then we could use the scheduling. In our case we are running every other week. Sometimes the jobs take longer than expected also making it difficult to predict the start and end times
I think I will go with option 1 and see how it goes
I think I will go with option 1 and see how it goes
-
- Enthusiast
- Posts: 28
- Liked: 3 times
- Joined: Jan 14, 2015 7:01 am
- Contact:
Re: Tape Job Priority / Backup Pause script
Same problem here. Currently fixed it with your solution #2. Works but is not very elegant and not very change resilient (e.g. if jobs are renamed my script requires to be updated...that could be fixed but I think it should be configurable !)
-
- Influencer
- Posts: 11
- Liked: 1 time
- Joined: Aug 04, 2015 8:13 am
- Full Name: Michael Custance
- Contact:
Re: Tape Job Priority / Backup Pause script
Hi Chas0rde
Would you be up for sharing your script?
Would you be up for sharing your script?
-
- Product Manager
- Posts: 14793
- Liked: 1728 times
- Joined: Feb 04, 2013 2:07 pm
- Full Name: Dmitry Popov
- Location: Prague
- Contact:
Re: Tape Job Priority / Backup Pause script
Hi guys,
Counted as a feature request. Meanwhile, can I ask why the option “If some linked backup jobs are still running, wait for up to … minutes” for backup to tape job does not solve the running job issue? ThanksWould be nice to have the option to say which job would have priority.
-
- Enthusiast
- Posts: 28
- Liked: 3 times
- Joined: Jan 14, 2015 7:01 am
- Contact:
Re: Tape Job Priority / Backup Pause script
Yes but I would like to do some improvements first. Once that is done I am happy to sharemc2 wrote:Hi Chas0rde
Would you be up for sharing your script?

-
- Influencer
- Posts: 11
- Liked: 1 time
- Joined: Aug 04, 2015 8:13 am
- Full Name: Michael Custance
- Contact:
Re: Tape Job Priority / Backup Pause script
thank you, ill wait for your update 

-
- Enthusiast
- Posts: 28
- Liked: 3 times
- Joined: Jan 14, 2015 7:01 am
- Contact:
Re: Tape Job Priority / Backup Pause script
Still working on the improvements (or waiting to find time to do them)
What I can say is that this does not work very well, as after some time VBR reports in the backup-to-disk job that the pre-script timed out. So it seems that "unlimited wait" is not possible or the script needs some tweaking
Currently I have a support case open with Veeam...we'll see if they find a solution
I'll keep you guys posted
What I can say is that this does not work very well, as after some time VBR reports in the backup-to-disk job that the pre-script timed out. So it seems that "unlimited wait" is not possible or the script needs some tweaking
Currently I have a support case open with Veeam...we'll see if they find a solution
I'll keep you guys posted
-
- Influencer
- Posts: 11
- Liked: 1 time
- Joined: Aug 04, 2015 8:13 am
- Full Name: Michael Custance
- Contact:
Re: Tape Job Priority / Backup Pause script
thank you for the update, I may go back to the plan of disabling the "disk" job a the start of the tape and then enable again at the end. Only draw back I guess is if the job was scheduled to run while it was disabled we would miss one of the backups
-
- Novice
- Posts: 3
- Liked: never
- Joined: Feb 29, 2016 4:13 pm
- Full Name: Thomas Beach
- Contact:
Re: Tape Job Priority / Backup Pause script
Hi Chas0rde
Would it be possible for you to share the pause script?
Would it be possible for you to share the pause script?
-
- Product Manager
- Posts: 20535
- Liked: 2348 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Tape Job Priority / Backup Pause script
You can take the following script as an rough example:
Thanks.
Code: Select all
asnp VeeamPSSnapin
do
{
$TapeJob = Get-VBRTapeJob -name "Name of your backup to tape job"
Start-Sleep -Seconds 300
} while ($TapeJob.LastState -eq "Working")
-
- Enthusiast
- Posts: 28
- Liked: 3 times
- Joined: Jan 14, 2015 7:01 am
- Contact:
Re: Tape Job Priority / Backup Pause script
Hello
I still did not find time to solve this issue to full satisfaction.
Pre-Job for the To-Disk-Job won't work:
1) Pre-Job will run into a timeout after some time and then continue the job thus killing the backup-to-tape. So this just gives you a "grace-period" of a sort
2) Pre-job have no parameter to set what should happen if they fail/timeout. Pre-Freeze has the option e.g. to fail the job if script fails. This would be nice for pre-/post-job as well, as sometimes with pre-/post-job scripts not going through correctly the backup might be inconsistent anyways (e.g. with multi-tier server infrastructures where several services need to be stopped before backup)
Basically my script does the same as the one mentioned by v.eremin
Here is the rough version (no guarantee for function/quality et cetera...still work in progress)
I still did not find time to solve this issue to full satisfaction.
Pre-Job for the To-Disk-Job won't work:
1) Pre-Job will run into a timeout after some time and then continue the job thus killing the backup-to-tape. So this just gives you a "grace-period" of a sort
2) Pre-job have no parameter to set what should happen if they fail/timeout. Pre-Freeze has the option e.g. to fail the job if script fails. This would be nice for pre-/post-job as well, as sometimes with pre-/post-job scripts not going through correctly the backup might be inconsistent anyways (e.g. with multi-tier server infrastructures where several services need to be stopped before backup)
Basically my script does the same as the one mentioned by v.eremin
Here is the rough version (no guarantee for function/quality et cetera...still work in progress)
Code: Select all
<#
.NAME
Veeam_Wait_for_TapeJob_pre.ps1
.SYNOPSIS
This script causes a Veeam Backup and Recovery Job to wait for its tape job to finish before running.
This helps prevent the tape job being aborted by the Backup-to-disk jo by setting it as a pre-run script.
If none or only some of the supplied scheduling suffixes are found a warning is generated.
.PARAMETER Job
The Tape Job to check
.PARAMETER scheduling_suffix
Comma-separated list of possible suffixes for Tape jobs. E.g. M for monthly, Q for quarterly.
This parameter is used to cycle through all possible Tape jobs, that might be interrupted by a backup-to-disk
job.
.PARAMETER [logfile]
Optional parameter to indicate the logfile to use. If not given logging is done to C:\temp\Veeam_pre-script\<jobname>
Logfiles older than 15 days will be removed.
.NOTES
Author: Ingo Pohlschneider <info@chas0r.de>
Date: August 03, 2015
#>
# define commandline parameters
param([Parameter(Mandatory=$true)][string]$Job,
[Parameter(Mandatory=$true)][string]$scheduling_suffix,
[string]$logfile)
if (-Not ($logfile)) {
$logtime = Get-Date -Format "yyyyMMdd_hhmmss"
$logpath = "C:\Temp\Veeam_pre-script\" + $job
$logfile = $logpath + "\PS_LOG_Veeam_Wait_for_TapeJob_" + $job + "_" + $logtime + ".log"
} else {
$logpath = Split-Path $logfile
}
# create logpath if not exists
New-Item -ItemType Directory -Force -Path $logpath
# cleanup old logfiles
$limit = (Get-Date).AddDays(-15)
# Delete files older than the $limit.
Get-ChildItem -Path $logpath -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force
Write-Output "Transcript log: " $logfile
Start-Transcript -path $logfile
#TEST GET JOBNAME AUTOMATICALLY
$parentpid = (Get-WmiObject Win32_Process -Filter "processid='$pid'").parentprocessid.ToString()
$parentcmd = (Get-WmiObject Win32_Process -Filter "processid='$parentpid'").CommandLine
$autojob = Get-VBRJob | ?{$parentcmd -like "*"+$_.Id.ToString()+"*"}
$session = Get-VBRBackupSession | ?{($_.OrigJobName -eq $autojob.Name) -and ($parentcmd -like "*"+$_.Id.ToString()+"*")}
Write-Output "AUTOJOB determined is $($autojob)"
Write-Output "Supplied Jobname is $($Job)"
Write-Output "Supplied scheduling suffixes are $($scheduling_suffix)"
# Load the Veeam Powershell Snapin
if (-not (Get-PSSnapin VeeamPSSnapin -ErrorAction SilentlyContinue)) {
Write-Output "Activating VeeamPSSnapin"
Add-PSSnapin VeeamPSSnapin
}
# Create array from suffix-list
[string[]]$suffixes = $scheduling_suffix.split(",")
Write-Output "Found the following suffixes: $($suffixes)"
Write-Output "Checking $($suffixes.Length) Tape Jobs"
# Cycle through tape jobs and see if one of them is still running
$count = 0
$ec = 0
foreach ($suffix in $suffixes) {
$curJob = $Job + "_" + $suffix
Write-Output "Checking $($curJob)"
if (-not ($TapeJob = Get-VBRTapeJob -name "$($curJob)" -ErrorAction SilentlyContinue)) {
Write-Output "Tape Job $($curJob) was not found"
$count++
} else {
$State = $TapeJob.LastState
while ($State -ne "Stopped") {
Write-Output "Tape Job $($curJob) still running. Waiting 60 seconds"
Start-sleep -s 60
$State = $TapeJob.LastState
}
Write-Output "Tape Job $($curJob) not running"
}
# Check if no job was found
if ($count -eq $suffixes.Length) {
Write-Output "No matching Tape Jobs found!"
$ec = 2
} elseif ($count -gt 0) {
Write-Output "Some Tape Jobs matching the scheduling suffixes supplied were not found!"
$ec = 3
}
}
Write-Output "Exiting with exit code $($ec)"
Stop-Transcript
exit $ec
Who is online
Users browsing this forum: Baidu [Spider] and 11 guests