Question

Triggering remote jobs to run after completion of local job


Userlevel 2

I have two sites a HQ and a remote office on the opposite coast that are connected via VPN, both are running Veeam B&R on a local server at each location to perform local backups. They also do a pull replication of each other for DR. I’m also running Enterprise Manager at HQ. 

How can I script the server(s) so that the remote pull replication job runs AFTER the local backup job so that the snapshots don’t overlap? I was hoping to use Enterprise Manager to trigger the job to run after the backup completed, but it can only see the local jobs, not the remote ones.


10 comments

Userlevel 7
Badge +20

That is correct that EM/VBR will only see jobs local to them.  Rather than doing a pull you may want to do a push from each site to the other then you can set the push job (Backup Copy/Replication) to run after the backup job completes.

Userlevel 7
Badge +20

On the Scheduling tab is where you set it up to run after job - Step 15. Define Job Schedule - User Guide for VMware vSphere (veeam.com)

Userlevel 2

I originally had it that way but realized this is not best practice for DR as advised by Veeam support since if I lose an entire site the replica data/job will be on the wrong side. Surely there must be a way for Veeam servers to see each other’s jobs or a way to script out a remote job kick off...

Userlevel 7
Badge +20

Not sure why Veeam Support would say that is not supported or a best practice.  If you have a backup job at the primary site and replication job runs to the opposite site, you are in best practice as you have a Veeam server in each site as you have noted.  This will then allow you to bring up the VMs in the opposite site should one go down since the replicas are accessible to the local VBR server.

As per here - Replication jobs - Veeam Backup & Replication Best Practice Guide

Userlevel 7
Badge +14

You're setup is perfectly fine that way. It’s recommended to have the VBR server which controls the replication at the DR site. So in case of a disaster you can failover via Veeam.

In your case, you could let the remote site also do the backup jobs at the primary site. That way you'll be able to chain backup and replication.

If you want to keep the current setup then I would suggest that you setup a stop/post script for your backup jobs. You can connect via Powershell to the other VBR server and start those replication jobs remotely.

https://helpcenter.veeam.com/docs/backup/powershell/connect-vbrserver.html?ver=110

https://helpcenter.veeam.com/docs/backup/powershell/start-vbrjob.html?ver=110

Userlevel 2

You're setup is perfectly fine that way. It’s recommended to have the VBR server which controls the replication at the DR site. So in case of a disaster you can failover via Veeam.

In your case, you could let the remote site also do the backup jobs at the primary site. That way you'll be able to chain backup and replication.

If you want to keep the current setup then I would suggest that you setup a stop/post script for your backup jobs. You can connect via Powershell to the other VBR server and start those replication jobs remotely.

https://helpcenter.veeam.com/docs/backup/powershell/connect-vbrserver.html?ver=110

https://helpcenter.veeam.com/docs/backup/powershell/start-vbrjob.html?ver=110

Thanks, I’ve been able to do this successfully but one nagging issue is the job finishes with a warning because of script timeout. Initially I pointed directly at the .ps1 file for post job script, but after reading about using exit /b 0 in a .bat file I’ve tried it that way too. The replication job does run either way, but I’d like the initial backup job that kicks off the script to finish without warning. Any suggestions? Thanks again this info has been really helpful. 

Userlevel 7
Badge +14

Does your script complete successfully when you run it manually? You could try to add it like this to your job:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File "C:\...\xyz.ps1"

 

Userlevel 2

Does your script complete successfully when you run it manually? You could try to add it like this to your job:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File "C:\...\xyz.ps1"

 

Yes thanks I wound up increasing job timeout via registry key:

 

HKEY_LOCAL_MACHINE\SOFTWARE\VeeaM\Veeam Backup and Replication\HKEY_LOCAL_MACHINE\SOFTWARE\VeeaM\Veeam Backup and Replication DWORD Value 5400 for 90 minute timeout window

Userlevel 7
Badge +14

Thanks for sharing the solution @sgoldhorn. I just think you have a copy/paste error? Was it the ‘PostJobScriptTimeoutSec’ key?

Userlevel 2

Thanks for sharing the solution @sgoldhorn. I just think you have a copy/paste error? Was it the ‘PostJobScriptTimeoutSec’ key?

Yes thanks, the key path is:

HKEY_LOCAL_MACHINE\SOFTWARE\VeeaM\Veeam Backup and Replication\PostJobScriptTimeoutSec

All jobs are now completing successfully thanks again

Comment