cancel
Showing results for 
Search instead for 
Did you mean: 

Delaying BPSTART notify

MLongmuir
Level 2

Hi team!

Struggling to find anything online, so thought I'd put the challenge to the brain trust here. 

I have a powershell script that needs to complete it's execution before the NetBackup job can officially kick off - even before the ESXi VM, which is the target client, is snapshotted.

The powershell script takes about 1min 30sec (give or take) to complete, without fail. 

I've dropped it into a bpstart_notify.<policyname>.bat file, popped it into the netbackup\bin folder and bam! It DOES run...but the the backup process doesn't wait for the powershell script to finish.

Is there any way to put a delay into the batch file? I tried adding in this line but it doesn't quite do the trick.

TIMEOUT /T 200 /NOBREAK. For example, here's the current implementation:

@REM --------------------------------------------------------------------
@REM main script starts here
@REM This is a simple script that records what kind of backup will be done along
@REM with other relevent information (Client name, policy name, etc) and
@REM appends the information to the results file
@REM --------------------------------------------------------------------
powershell -executionpolicy remotesigned -File "D:\Source Files\Scripts\backup_test.ps1"
TIMEOUT /T 250 /NOBREAK
@REM print a generic message since MB608 backup is neither full, nor cumulative incremental
@Echo backup/restore MB608 started on %1 using policy %2 with schedule %3 and status %5, bpres = %6 > bin\BP_RES.txt
@Echo 0 > %6
@Goto :EOF
@REM exit 0

 

Any thoughts? 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Marianne
Moderator
Moderator
Partner    VIP    Accredited Certified

That is precisely how NetBackup works. Any kind of snapshot backup will call bpfis first to take a snapshot. This ensures that the data is in consistent state before bpbkar is called. This cannot (or should not) be changed.
The snapshot method that is used can be seen in bpfis log.

What exactly is it that you need to do before the snapshot?

View solution in original post

5 REPLIES 5

Marianne
Moderator
Moderator
Partner    VIP    Accredited Certified

I am wondering if powershell is actually supported with bpstart_notify.

I have seen examples of notify scripts calling scripts, but not powershell.

The test normally is to see what happens if you run the command/script from cmd. 
Does it return to the prompt immediately or only when the script has completed?

This TN shows how to add custom script to the notify scripts: https://www.veritas.com/support/en_US/article.000088828

 

Thanks, Marianne. 

Can't answer the support question - but it does work, that's for sure. And I'm aware Veritas doesn't support custom scripts - that's fine, no problem.

To answer your question - it returns to the prompt once it has completed. Not immediately.

The plot has thickened today, as I'm narrowing down where the issue actually is, in my particular scenario. 

Simply putting in a "delay" is possible (using the sleep.exe or timeout commands, pending windows version).

Example, adding these lines into the batch (which exceeeds the default timeout values, so causes an error 74 as expected):

TIMEOUT /T 250 /NOBREAK
"C:\Program Files (x86)\Windows Resource Kits\Tools\sleep.exe 250"

Now, the backup I'm looking to run this script against first, is of a FlashBackup-Windows/vmware policy type, snapshotting the VM for backup. What I'm noticing is that the vm snapshot occurs FIRST, before the bpbkar process executes the bpstart scripts. 

So my questions are now: 

1. Is that correct? VM snapshot will occur before bpbkar get's in. 

2. Can this behaviour be changed?

3. Is there a way to run a script BEFORE the snapshot (inside netbackup)? 

I have a feeling i'm heading down windows task scheduler territory to do the pre-work before the backup runs, but am still hoping against hope that i can keep it tied to the Netbackup / netbackup policy. 

 

Marianne
Moderator
Moderator
Partner    VIP    Accredited Certified

That is precisely how NetBackup works. Any kind of snapshot backup will call bpfis first to take a snapshot. This ensures that the data is in consistent state before bpbkar is called. This cannot (or should not) be changed.
The snapshot method that is used can be seen in bpfis log.

What exactly is it that you need to do before the snapshot?

Excellent, sort of. At least it confirms what I've been reading in some other places, thanks Marianne!

What I need to do is execute some changes of the VM itself, pre snapshot, to ensure those are captured in the backup. 

I think I can still keep it bundled, to a degree, by adding a bpbackup command at the end of the script to execute the backup. A quick test (of the bpbackup -i -p <policy> -s <schedule name>) and that worked. I'm going to play around with this idea tomorrow. 

It's a bit convoluted but unavoidable at this time it seems, with what I have to play with....and it should work....i think. 

Will update tomorrow after some testing and, touch wood, give you the tick and close this query out. Fingers crossed. 

 

Ok, so that worked. 

The pre-backup script, that needs to complete BEFORE the vm snapshot takes place, now contains a line right at the end that executes the backup: 

bpbackup -i -p <policy name> -s <schedule>

Slapped it into Task Scheduler on my windows netbackup server and bam, happy days. We're cooking with gas. 

Thanks, Marianne, for the feedback and info on some of the processes which prooved to be pivotal information (regarding bpfis, snapshots, bpbkar...). 

Closing this one out. Thumbs up!