Forum Discussion

MLongmuir's avatar
MLongmuir
Level 2
8 years ago
Solved

Delaying BPSTART notify

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? 

 

 

  • Marianne's avatar
    Marianne
    8 years ago

    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?

  • 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

     

    • MLongmuir's avatar
      MLongmuir
      Level 2

      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's avatar
        Marianne
        Level 6

        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?