Forum Discussion

J_H_Is_gone's avatar
15 years ago

Number of streams (Widnows) NB 7.0

Unix master/windows client.

I know I can run on the client - bpstart_notify.bat  - my understanding is that this will run for each job - so 1 job 1 run.

I know I can run on the client - bpend_notify.bat - again 1 job 1 run.

but

If my policy is to allow multi jobs, lets say 6

so I get 1 parent and 6 children

that bpstart_notify.bat would run 6 times

the bpend_notify.bat woudl run 6 times.

 

my issue is -

that now the bpstart runs 6 times, and the bpend runs 6 times, sometimes it goes

start/start/end/start/end/start/start/start/end/end/end

 

so the end script runs before the other jobs have finished - not what I want.

 

I want bpstart_notify.bat to run for the FIRST child only

I want bpend_notify.bat to run for teh LAST child only

( I know parent_end/start_notify can do this but I have a unix master and would perfer it to run on the client as the commands need to run on the client - and I want to do this for a LOT of clients - so that would be a lot of if statements)

Now the backup_start_notify.bat has a param for the number of streams which is good, but as far as I can tell it will only run on the master. ( am I wrong here?)  and it does not wait to finish before starting the child - so my script may not be done before the job starts so that rules this out.

 

 

(I know I could write this in unix for the bpstart and bpend to count a variable)

Any suggestions?  Unix master   windows client - I only want the script to run on the start of the first child and the end of the last child.

Is there a command you can run on a windows client to tell you how many jobs are active/queued for that client?

3 Replies

  • Hi JH

    I was cleaning up veritas-bu emails the other day and vaguely remember that someone shared a script that will only run against the 1st stream. Hopefully that is one of the emails that I've kept. Let me see what I can find....

     

    ***** EDIT ******

    For bpstart-notify, I found this email from 'François-Xavier Peretmere' dated Wednesday 20 June, 2001:

     you have to implement some logic in your bpstart / bpend to do the "action" unique for all streams for a given job (ie. class & schedule). usual way is to have some sort of locking to know if the action has already been done or not.

     you use the STREAM_NUMBER and STREAM_COUNT variables to do that.

     a quick & dirty way is to decide stream 1 will do the action:

     

     if [ $STREAM_NUMBER -eq 1 ]; then

       DO_ACTION

     else

       DO_NOTHING_OR_SMT_ELSE

     fi

    *****************************************

    For bpend-notify, there's this one from 'Carlos Alberto Lima dos Santos' dated Wed 2009/10/07:

     

    use this test in bpend_notify script

    #---------------------------------------------------------------------
    # Verify if exists some bpbkar pid started by the same policy
    # if exists then do not execute the bpend_notify script
    #---------------------------------------------------------------------
    CONT=0
    for PID in `cat $BPBKARPID`
    do
       NPID=`ps -e | grep -w $PID | grep -v grep | wc -l`
       CONT=`expr $CONT + $NPID`
    done

    if [ $CONT -gt 1 ]
    then
       echo "Still has bpbkar being executed. bpend_notify not executed" >> $LOGFILE
       exit 1
    fi

  • Using a flag file was my first thought  (do that a log in unix).

    I was really hopping for something easier as this will be on windows servers - so now I just have to work with one of my guys who can write dos scripts really good.

    I can give him my version for unix and see if he can 'translate' it into dos commands.

     

    the issue is I want stream 1 to do something for start, and I want the last job finished to do something for end.

     

     

  • There is a little known DOS command "Start".  You can issue the Start command to run another command and have a "WAIT" flag at the end.  The next command will not run until the first has completed.  The full syntax is below.

    Starts a separate window to run a specified program or command.

    START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
          [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
          [/WAIT] [/B] [command/program]
          [parameters]

        "title"     Title to display in  window title bar.
        path        Starting directory
        B           Start application without creating a new window. The
                    application has ^C handling ignored. Unless the application
                    enables ^C processing, ^Break is the only way to interrupt
                    the application
        I           The new environment will be the original environment passed
                    to the cmd.exe and not the current environment.
        MIN         Start window minimized
        MAX         Start window maximized
        SEPARATE    Start 16-bit Windows program in separate memory space
        SHARED      Start 16-bit Windows program in shared memory space
        LOW         Start application in the IDLE priority class
        NORMAL      Start application in the NORMAL priority class
        HIGH        Start application in the HIGH priority class
        REALTIME    Start application in the REALTIME priority class
        ABOVENORMAL Start application in the ABOVENORMAL priority class
        BELOWNORMAL Start application in the BELOWNORMAL priority class
        WAIT        Start application and wait for it to terminate
        command/program
                    If it is an internal cmd command or a batch file then
                    the command processor is run with the /K switch to cmd.exe.
                    This means that the window will remain after the command
                    has been run.

                    If it is not an internal cmd command or batch file then
                    it is a program and will run as either a windowed application
                    or a console application.

        parameters  These are the parameters passed to the command/program


    If Command Extensions are enabled, external command invocation
    through the command line or the START command changes as follows:

    non-executable files may be invoked through their file association just
        by typing the name of the file as a command.  (e.g.  WORD.DOC would
        launch the application associated with the .DOC file extension).
        See the ASSOC and FTYPE commands for how to create these
        associations from within a command script.

    When executing an application that is a 32-bit GUI application, CMD.EXE
        does not wait for the application to terminate before returning to
        the command prompt.  This new behavior does NOT occur if executing
        within a command script.

    When executing a command line whose first token is the string "CMD "
        without an extension or path qualifier, then "CMD" is replaced with
        the value of the COMSPEC variable.  This prevents picking up CMD.EXE
        from the current directory.

    When executing a command line whose first token does NOT contain an
        extension, then CMD.EXE uses the value of the PATHEXT
        environment variable to determine which extensions to look for
        and in what order.  The default value for the PATHEXT variable
        is:

            .COM;.EXE;.BAT;.CMD

        Notice the syntax is the same as the PATH variable, with
        semicolons separating the different elements.

    When searching for an executable, if there is no match on any extension,
    then looks to see if the name matches a directory name.  If it does, the
    START command launches the Explorer on that path.  If done from the
    command line, it is the equivalent to doing a CD /D to that path.