Comprehensive data protection for all workloads
cffit
Veteran
Posts: 338
Liked: 35 times
Joined: Jan 20, 2012 2:36 pm
Full Name: Christensen Farms
Contact:

Backup Copy Jobs kicked off after Backup Job?

Post by cffit »

Can I set a backup copy job to run after a normal backup job finishes? I'd like for each time a job is finished running to kick off the corresponding BC job (I setup my BC jobs to be the same as the normal backup jobs). I don't see a way to do this in the interface.
Shestakov
Veteran
Posts: 7328
Liked: 781 times
Joined: May 21, 2014 11:03 am
Full Name: Nikita Shestakov
Location: Prague
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by Shestakov »

Sure, you can either specify the backup copy job as a secondary target for the source job or point the backup copy job as the post job activity.
Thanks!
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by veremin »

What schedule does your backup job have? Daily? If so, set a daily copy interval for a backup copy job and make start 5 minutes after a backup job executes. Say, a backup job typically starts at 18:00, in this case you'll have to schedule a backup copy job to start at 18:05. This way, the backup copy job will start to create a new restore point as soon as the backup job finishes. Thanks.
cffit
Veteran
Posts: 338
Liked: 35 times
Joined: Jan 20, 2012 2:36 pm
Full Name: Christensen Farms
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by cffit »

Thanks guys. A requested feature I'd have would be an option under secondary target to run after the primary job finishes. I know I can manually set a time here and that's fine, but down the road as I change schedules I'll need to remember to also change this secondary schedule. If there was an option for the secondary target for "run after primary finishes" then no matter what I set my primary schedule to be, I won't have to also go and change the secondary schedule as well.
cffit
Veteran
Posts: 338
Liked: 35 times
Joined: Jan 20, 2012 2:36 pm
Full Name: Christensen Farms
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by cffit »

Also, now that I think about it, I just setup our weekend jobs to run on a different schedule via powershell and scheduled tasks. This changes the scheduled times that the backup jobs run on the weekends. Now with there being no connection between the primary and secondary job, I have to manually script the secondary jobs as well. If the secondary job had the option to run after the primary job finished, then I wouldn't have to worry about this either. Or if VEEAM simply had a way in the GUI to set different times for weekend jobs vs weekday jobs, this wouldn't be an issue either. Very frustrating that the scheduling in the software isn't flexible in this way. This could be fixed so easily and make life so much better for so many people.

Do you have the syntax for powershell commands to kick off a backup copy job please?
PTide
Product Manager
Posts: 6408
Liked: 724 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by PTide »

Do you have the syntax for powershell commands to kick off a backup copy job please?
Sure. Please see this article.

Thank you.
cffit
Veteran
Posts: 338
Liked: 35 times
Joined: Jan 20, 2012 2:36 pm
Full Name: Christensen Farms
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by cffit »

Thank you, but how would I specify the time and day this runs? Can you give an example of how I would tell the backup copy job to run at say 3:05AM on Saturdays? And then to change it back, how I would tell it to run on other days at 8:05PM?
Shestakov
Veteran
Posts: 7328
Liked: 781 times
Joined: May 21, 2014 11:03 am
Full Name: Nikita Shestakov
Location: Prague
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by Shestakov »

Provided script starts synchronization once the script is executed. You can set the script as the post-job activity for the source job.
cffit
Veteran
Posts: 338
Liked: 35 times
Joined: Jan 20, 2012 2:36 pm
Full Name: Christensen Farms
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by cffit »

I have one script that runs every Saturday morning which changes my backup schedules for all my jobs to start at earlier times. Then one script to run on Monday at noon that changes the schedules back to the weekday job times.

I want to be able to have one script where I can adjust the time of all my backup copy jobs and one scheduled task? Is there no way to set the scheduled time and day for a backup copy job per powershell like there is for regular backups?
Shestakov
Veteran
Posts: 7328
Liked: 781 times
Joined: May 21, 2014 11:03 am
Full Name: Nikita Shestakov
Location: Prague
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by Shestakov »

As I wrote in my first post
you can either specify the backup copy job as a secondary target for the source job or point the backup copy job as the post job activity.
Scripting is not necessary. However, you can include the backup copy synchronization script to yours or just paste it in the post-job activity.
Since you run the existing script twice a week, but you want backup copy synchronization to be executed daily, it`s easier to split the scripts.
cffit
Veteran
Posts: 338
Liked: 35 times
Joined: Jan 20, 2012 2:36 pm
Full Name: Christensen Farms
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by cffit »

I still don't understand how I can just have one script to change 10 jobs if I have to specify the post job activity in each job itself.

My question is, can I specify a schedule with powershell for when the backup copy jobs run. By specify I mean day and time.
Shestakov
Veteran
Posts: 7328
Liked: 781 times
Joined: May 21, 2014 11:03 am
Full Name: Nikita Shestakov
Location: Prague
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by Shestakov »

You can create a .bat file with the script inside:

Code: Select all

Get-VBRJob -Name "Backup Copy Job 1" | Sync-VBRBackupCopyJob
Get-VBRJob -Name "Backup Copy Job 2" | Sync-VBRBackupCopyJob
Get-VBRJob -Name "Backup Copy Job 3" | Sync-VBRBackupCopyJob
and make a schedule when to run the script. The script will start synchronication for the preset jobs.

Or you can paste

Code: Select all

Get-VBRJob -Name "Backup Copy Job 2" | Sync-VBRBackupCopyJob
To the post-job activity string of the source backup job and once the job is finished, script will start the synchronization of the Backup Copy Job 2.

Is that what you are looking for?
cffit
Veteran
Posts: 338
Liked: 35 times
Joined: Jan 20, 2012 2:36 pm
Full Name: Christensen Farms
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by cffit »

So in the top example, I would have to start them all at the same time, which I don't want all 10 jobs running at once.

For the bottom example, I need 10 separate scripts and also to remember to make another one each time I make a new backup job.

I currently have two scripts total. One runs on Saturday morning and sets all the regular backup jobs to run at the specified times on Saturday. Then one script that runs Monday at noon to set all the jobs to run at their specified times on the weekdays. I want to just modify these two scripts to include backup copy jobs, and set each line for backup copy job to be 5 minutes after the time that the backup is set for. Is this not possible to use powershell to set the time/schedule of a backup copy job?
Shestakov
Veteran
Posts: 7328
Liked: 781 times
Joined: May 21, 2014 11:03 am
Full Name: Nikita Shestakov
Location: Prague
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by Shestakov »

You are correct about scripts logic.
For the second case, it`s just one line, not that much to write.
cffit wrote:Is this not possible to use powershell to set the time/schedule of a backup copy job?
It is possible. Just create script with one lane

Code: Select all

Get-VBRJob -Name "Backup Copy Job 1" | Sync-VBRBackupCopyJob
and set task scheduler to run the script whenever you want to.

As was mentioned scripts are not even necessary, backup copy job will do it job anyway. You can set shorter synchronization interval and backup copy job would check new restore points every minute or so.
cffit
Veteran
Posts: 338
Liked: 35 times
Joined: Jan 20, 2012 2:36 pm
Full Name: Christensen Farms
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by cffit » 1 person likes this post

If I set the Backup Copy job to run every 30 minutes, that would be around 48 copy intervals per day. If I only have one file to copy each day, will I get alerts from the other 47 intervals stating "Incremental copy was not processed during the copy interval"? Or am I misunderstanding how all this works? I notice that on the one day a week that we don't do backups, I get email alerts with this error because there are no new backup files to copy over that day, and I currently had our BC interval set to 24 hours.
Shestakov
Veteran
Posts: 7328
Liked: 781 times
Joined: May 21, 2014 11:03 am
Full Name: Nikita Shestakov
Location: Prague
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by Shestakov »

You are correct. Backup copy job tells you that no restore points are found.
cffit
Veteran
Posts: 338
Liked: 35 times
Joined: Jan 20, 2012 2:36 pm
Full Name: Christensen Farms
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by cffit »

So I would get emails everyday alerting me of that if I went this method?
Shestakov
Veteran
Posts: 7328
Liked: 781 times
Joined: May 21, 2014 11:03 am
Full Name: Nikita Shestakov
Location: Prague
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by Shestakov »

Yes. If you don`t want to get emails, I would go for script at post-job activity as was described above.
foggy
Veeam Software
Posts: 21069
Liked: 2115 times
Joined: Jul 11, 2011 10:22 am
Full Name: Alexander Fogelson
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by foggy »

cffit wrote:I currently have two scripts total. One runs on Saturday morning and sets all the regular backup jobs to run at the specified times on Saturday. Then one script that runs Monday at noon to set all the jobs to run at their specified times on the weekdays. I want to just modify these two scripts to include backup copy jobs, and set each line for backup copy job to be 5 minutes after the time that the backup is set for. Is this not possible to use powershell to set the time/schedule of a backup copy job?
In the first script, along with modifying each backup job's schedule, you can also add the post-job command to it that will perform sync for the corresponding backup job. In the second script, you can remove this post-job command.
cffit
Veteran
Posts: 338
Liked: 35 times
Joined: Jan 20, 2012 2:36 pm
Full Name: Christensen Farms
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by cffit »

Foggy - can you post the syntax I would use for that please? I think that would be what I'd want to do. Thank you.
ddayton
Enthusiast
Posts: 45
Liked: 19 times
Joined: Nov 12, 2012 6:40 pm
Full Name: Don Dayton
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by ddayton »

With the last post it made me want to add this comment. Wouldn't it be nice if we had a check box to disable that nagging backup copy alert about no new backup files. I have EPB on my laptop target a repository and all EPB backups to that repository use Backup Copy to move the backups to the NAS storage in the DR site. Of course while I'm off for vacation, holidays and weekends there are no new backup files for my laptop, so my department receives this alert nag, since I use an e-mail group distribution for Veeam B&R and Veeam ONE.
Shestakov
Veteran
Posts: 7328
Liked: 781 times
Joined: May 21, 2014 11:03 am
Full Name: Nikita Shestakov
Location: Prague
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by Shestakov »

Don, if you don`t backup and not expect backup copy job to work during the period, you can just disable it. It will take even less time (clicks) than to activate/deactivate the warning checkbox you mentioned.
Thanks
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by veremin »

If you're looking for a way to enable/disable post-job activity, check the following script:

Code: Select all

Asnp VeeamPSSNapin
$Job = Get-VBRJob -name "Name of your Job"
$Options = $Job.GetOptions()
$Options.JobScriptCommand.PostScriptEnabled = $false #$True - enable, $False - disable
$Job.SetOptions($Options)
Thanks.
foggy
Veeam Software
Posts: 21069
Liked: 2115 times
Joined: Jul 11, 2011 10:22 am
Full Name: Alexander Fogelson
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by foggy »

Just to elaborate on what Vladimir's suggested, instead of adding and removing the post-job command for the backup job each time (as I've suggested above), you can specify it in the job settings and just enable/disable in your weekend scripts. For the post-job command itself, please use the syntax that calls backup copy job sync mentioned in this thread above.
cffit
Veteran
Posts: 338
Liked: 35 times
Joined: Jan 20, 2012 2:36 pm
Full Name: Christensen Farms
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by cffit »

Can you give me a one liner script for a job named "Job 1" for instance?
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by veremin »

Sure,

Code: Select all

Set-VBRJobAdvancedOptions -Job (Get-VBRJob -name "Job 1") -Enabled $false
Thanks.
cffit
Veteran
Posts: 338
Liked: 35 times
Joined: Jan 20, 2012 2:36 pm
Full Name: Christensen Farms
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by cffit »

So I'm a little confused. That line just enables or disabled the advanced options of the job right? So even with this, I need to have other scripts that kick off the backup copies in the main job?
foggy
Veeam Software
Posts: 21069
Liked: 2115 times
Joined: Jul 11, 2011 10:22 am
Full Name: Alexander Fogelson
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by foggy »

That line enables or disables specifically the execution of the post-job command specified in the job settings. You just need to specify backup copy job manual sync as a post-job command, like this:

Code: Select all

powershell.exe "Get-VBRJob -Name "Backup Copy Job 2" | Sync-VBRBackupCopyJob"
Or, if you do want to set it in the main script as well, you could include there something like this:

Code: Select all

Set-VBRJobAdvancedOptions -Job (Get-VBRJob -name "Job 1") -CommandLine "powershell.exe "Get-VBRJob -Name "Backup Copy Job 2" | Sync-VBRBackupCopyJob""
cffit
Veteran
Posts: 338
Liked: 35 times
Joined: Jan 20, 2012 2:36 pm
Full Name: Christensen Farms
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by cffit »

Shestakov wrote: As was mentioned scripts are not even necessary, backup copy job will do it job anyway. You can set shorter synchronization interval and backup copy job would check new restore points every minute or so.
I tried this and set it to 5 minutes. Now I notice every 5 minutes backup copy creates a 30MB empty restore point which then creates a mess of bogus restore points. I don't recommend this method from my experience. We send our backup copies to cloud and have a set number of restore points to keep. With this method if I have this set to 10 restore points, I get 9 empty restore points from the last 45 minutes that just overwrite themselves.

I so wish I could have my backup copy interval set to once a day, and there was a PowerShell command that could just simply change the time this interval runs for the weekend.
foggy
Veeam Software
Posts: 21069
Liked: 2115 times
Joined: Jul 11, 2011 10:22 am
Full Name: Alexander Fogelson
Contact:

Re: Backup Copy Jobs kicked off after Backup Job?

Post by foggy »

Setting that frequent sync interval when the source backup job runs daily is indeed not recommended. Have you tried the suggestion from my previous post? Should allow you to do everything from a single external script, as you were after.
Post Reply

Who is online

Users browsing this forum: Gostev, jp.verlande, RValensise, Semrush [Bot] and 176 guests