Forum Discussion

JohnOBrien's avatar
JohnOBrien
Level 3
11 years ago

Script/Command that will suspend all Active jobs for Client @ 7:00am

Hi There,

 

Anyone know of a script or command that exists that would enable me to suspend all active jobs for Netbackup client @ 7:00am and then resume them at 10pm?

I have looked at bpdbjobs and found that I can suspend via

-suspend xxxxxxx

but as I would like this script to be scheduled I require something that will

-suspend * -client myclent

Any ideas appreciated.

John

  • OK - it wasn't quite as bad as i thought!!

    So here you go .. these assume that we make a directory on the Master Server named C:\suspendjobs\ and in there we make three files, suspend.bat, check.vbs and resume.bat.

    It also assumes that your environment variables are setup so /netbackup/bin/admincmd/ is in your path, if not edit these to add in the full paths remembering to use quotes around them if there are any spaces (so "C:\Program Files\veritas\netbackup\bin\admincmd\bpdbjobs" -report)

    It also assumes that your clients name is server1 - so change that in the scripts.

    Windows scheduler will then run suspend.bat at 7am and resume.bat at 10pm

    So the contents need to be:

    suspend.bat:

    del /Q c:\suspendjobs\runningjobs.txt
     
    bpdbjobs -report -all_columns -ignore_parent_jobs> c:\suspendjobs\alljobs.txt
     
    c:\suspendjobs\check.vbs
     
    for /f %%a in (c:\suspendjobs\runningjobs.txt) do bpdbjobs -suspend %%a -quiet

    check.vbs:

    Const ForReading = 1

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile("C:\suspendjobs\alljobs.txt", ForReading)


    Do Until objFile.AtEndOfStream
        strLine = objFile.ReadLine
        arrFields = Split(strLine,",")

        If InStr(arrFields(6), "server1") And InStr(arrFields(3), "")<=0 Then
            strContents = strContents & arrFields(0) & vbCrlf
        End If
    Loop

    objFile.Close


    Set objFile = objFSO.CreateTextFile("c:\suspendjobs\runningjobs.txt")
    objFile.Write strContentsa

    objFile.Write strContents


    objFile.Close

    resume.bat:

    for /f %%a in (c:\suspendjobs\runningjobs.txt) do bpdbjobs -resume %%a -quiet

15 Replies

Replies have been turned off for this discussion