Comprehensive data protection for all workloads
Post Reply
Kraken
Influencer
Posts: 19
Liked: 2 times
Joined: Jul 30, 2012 8:23 am
Full Name: Jaroslav Haken
Contact:

Backup Copy Job and post-job script in v12

Post by Kraken »

I've recently updated Veeam B&R to v12, recreated the Backup Copy Job from scratch and since then the the same post-job script starts to time out.

I found this post about the steps taken during the Backup Copy job> veeam-backup-replication-f2/backup-copy ... 38865.html but I'm not sure if it's still actual. I remember, that maximum run time for the post-job script is 60 minutes.

Here's the setup:
Backup Copy Job in Periodic copy mode is set to launch the script.bat as a post job script ("Run the following script after the job"; Run this scripts every 1 backup session). This Backup Copy job processes three objects: Backup Job 1, Backup Job 2 and Backup Job 3 (in this order). These Backup Jobs have no attached scripts.

What is happening:
1) 9:00 - the Backup Copy job runs automatically
2) 9:17 - received mail "Backup Copy Job / Backup job 2 finished successfully"
3) 9:28 - received mail "Backup Copy Job / Backup job 3 finished successfully"
4) 10:14 - received mail "Backup Copy Job / Backup job 1 finished with Warning - post job script timed out"

According to the same mail about "Backup Copy Job / Backup job 1", it's clear, that the VM processing is finished in 14 minutes (at 9:14) and after that, the 60 minutes limit for the Backup Copy Job post-job script starts. Which is probably not correct behavior, because it's post-job script for the whole Backup Copy job and not the first object in the queue.

Also, according to the the script log (robocopy is used) script starts at 9:10 (which is just before the VMs in the "Backup Copy Job / Backup job 1" are processed) and all processing in the script ends correctly in time (9:29) before Veeam "Backup Copy Job / Backup job 1" reports the post-job timeout.

Am I doing something wrong or is the post-job script behavior simply different in v12?
HannesK
Product Manager
Posts: 14759
Liked: 3044 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: Backup Copy Job and post-job script in v12

Post by HannesK »

Hello,
mhm, that sounds wrong. I see the same. That behavior is documented for immediate copy. But not for periodic mode.

I will come back on this (that can take some time...)

Best regards,
Hannes
HannesK
Product Manager
Posts: 14759
Liked: 3044 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: Backup Copy Job and post-job script in v12

Post by HannesK »

Hello,
QA confirmed, that the behavior you can see is correct and that the user guide will be updated.

The post-script runs after each backup job finished. So you probably would need to adjust the script a bit.

Best regards,
Hannes
Kraken
Influencer
Posts: 19
Liked: 2 times
Joined: Jul 30, 2012 8:23 am
Full Name: Jaroslav Haken
Contact:

Re: Backup Copy Job and post-job script in v12

Post by Kraken »

If you call something "post-job script" and label it as "Run the following script after the job" I would kinda expect that it will run AFTER the WHOLE job and not after the finishing the first item on the Backup Copy job list. This behavior simply does not make any sense... why is it made this way instead of the original behavior?

Also, can you tell me then, how do I launch the script AFTER the WHOLE Backup Copy job is finished? Because I see no option for this.
HannesK
Product Manager
Posts: 14759
Liked: 3044 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: Backup Copy Job and post-job script in v12

Post by HannesK »

I agree with you and I'm discussing the details since last week. Due to "out of office", the answer will take some time. I will update the thread once I have more informatoin.
GenDev
Enthusiast
Posts: 33
Liked: 4 times
Joined: Jul 17, 2020 10:58 pm
Contact:

Re: Backup Copy Job and post-job script in v12

Post by GenDev »

I'm going to have to agree that this behavior doesnt make sense. I just updated my backup copy jobs to the V12 standard. I have a backup copy job that has 20 objects it. The post-job script ran 20 times instead of 1 time when the entire job is complete. Kind of a big difference between a "post-backup" script and a "post-job" script.
HannesK
Product Manager
Posts: 14759
Liked: 3044 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: Backup Copy Job and post-job script in v12

Post by HannesK »

yes, everyone in this thread agrees on that.

the post-scripts you run are PowerShell? If yes, then there is probably a solution by checking how many worker jobs are running. I will come back with some lines of code once it's confirmed.
GenDev
Enthusiast
Posts: 33
Liked: 4 times
Joined: Jul 17, 2020 10:58 pm
Contact:

Re: Backup Copy Job and post-job script in v12

Post by GenDev »

Not sure about the original poster. But, in my case, yes they are powershell scripts.
HannesK
Product Manager
Posts: 14759
Liked: 3044 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: Backup Copy Job and post-job script in v12

Post by HannesK »

Hello,
if you adopt your script and put it into the "place your script here" section and adopt it to match your needs, this script should help.

Code: Select all

$cj = Get-VBRJob -name "CopyJobName" 
$workers = $cj.GetWorkerJobs() | Where-Object {$_.isrunning -eq "True"}

if ($workers.count -eq 1)
{
#place your script here
Write-Host "executing post-script"
}

else
{
Write-Host "There is more than one running child job. Not doing anything"
} 
Let is know, how it goes.

Best regards,
Hannes
GenDev
Enthusiast
Posts: 33
Liked: 4 times
Joined: Jul 17, 2020 10:58 pm
Contact:

Re: Backup Copy Job and post-job script in v12

Post by GenDev »

Unfortunately, the script didn't work for me. I tested it on a job that wasn't running and it kept going to the "Else". I would've thought it would go to the "executing post-script".
Albertinator
Lurker
Posts: 1
Liked: never
Joined: Mar 23, 2020 10:09 am
Full Name: Johannes Wecker
Contact:

Re: Backup Copy Job and post-job script in v12

Post by Albertinator »

Had the same issue.
After changing the 1 to a 0 the script works for us.

Thank you for the help!
HannesK
Product Manager
Posts: 14759
Liked: 3044 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: Backup Copy Job and post-job script in v12

Post by HannesK »

Thanks! Just a quick update... we plan to fix this issue (hopefully in V12a, but not guaranteed yet)
dittmann.IT
Lurker
Posts: 2
Liked: never
Joined: Aug 17, 2023 12:03 pm
Full Name: Rico Dittmann
Contact:

Re: Backup Copy Job and post-job script in v12

Post by dittmann.IT »

Was the problem solved in P20230718?
HannesK
Product Manager
Posts: 14759
Liked: 3044 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: Backup Copy Job and post-job script in v12

Post by HannesK »

Hello,
and welcome to the forums. No, V12 P20230718 is before V12a. The script is still the workaround.

Best regards,
Hannes
dittmann.IT
Lurker
Posts: 2
Liked: never
Joined: Aug 17, 2023 12:03 pm
Full Name: Rico Dittmann
Contact:

Re: Backup Copy Job and post-job script in v12

Post by dittmann.IT »

The posted script are no solution for me. I want to run a curl command. Unfortunately it doesn't do that. But in Powershell runs this script perfect.

Code: Select all

$cj = Get-VBRJob -name "BACKUP" 
$workers = $cj.GetWorkerJobs() | Where-Object {$_.isrunning -eq "True"}

if ($workers.count -eq 0)
{
Write-Host "executing post-script"
cd "C:\Program Files (x86)\BACKUP\"
curl http://192.168.184......
}

else
{
Write-Host "There is more than one running child job. Not doing anything"
} 
Post Reply

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 44 guests