Veritas-bu

[Veritas-bu] RE: Windows Script/Batch for Catalog Backups

2003-05-29 10:03:44
Subject: [Veritas-bu] RE: Windows Script/Batch for Catalog Backups
From: Jesse.Gardner AT storaenso DOT com (Gardner, Jesse)
Date: Thu, 29 May 2003 09:03:44 -0500
Here's some Vbscript that I use for a couple reasons.  It runs bpdbjobs.exe
to check how many active/queued/requeued jobs there are.  If there are more
than 0, it waits 30 seconds and tries again.  If there are 0, it proceeds to
run the catalog backup.  Put this in a .vbs file, call it from Windows
Scheduled Tasks at 4:00am daily, and your catalog backup will start when all
active jobs are finished.  Note: You need the
"%InstallDir%\NetBackup\bin\admincmd" in your system PATH variable so the
script can find bpdbjobs.exe and bpbackupdb.exe.
-----------------------------------------
set objShell = CreateObject("WScript.Shell")

While GetActiveJobCount > 0     
        wscript.sleep 30000 'Wait 30 seconds and check again
Wend

'No Active jobs, do the catalog backup.
objShell.Run("bpbackupdb.exe")
Set objShell = Nothing

Function GetActiveJobCount()
        set oExec = objShell.Exec("bpdbjobs -summary -all_columns")
        intActive = 0
        If Not oExec.StdOut.AtEndOfStream then 'There's a line to read.
                strLine = oExec.StdOut.ReadLine()
                strCatArray = Split(strLine,",")
                for i = 1 to 3 'Look at Queued, ReQueued, and Active.
                        intActive = intActive +
int(mid(strCatArray(i),instr(strCatArray(i),"=")+1))
                next
                WScript.Sleep 25
        end if
        GetActiveJobCount = intActive
        set oExec = nothing
End Function
-----------------------------------------

Jesse Gardner

<Prev in Thread] Current Thread [Next in Thread>