Forum Discussion

Satkay_Satish's avatar
13 years ago

bpstart & bpend notify scripts for multistreaming jobs

Hi Experts,

On testing out bpstart & bpend notify scripts for multistreaming jobs found that they get called for each child job.

On research i came across following Tech note which suggests way to write it but don't have any ready scripts. Undestand that they are provided as part of consulting services frown

http://www.symantec.com/business/support/index?page=content&id=TECH69986

 

If anybody have them running in their environment, appreciate if you can share the same.

 

Thanks in advance.yes

Satkay

  •  

    • Created a folder to contain LOCK files for each policy. Each policy to have separate folder 

                /usr/openv/netbackup/bin/SI_logs/Byron804_SI_Byron80_db

    • Create lock file for each triggered backup job for policy in its respective folder

              Added the following line in bpstart_notify on media server

              OUTF=/usr/openv/netbackup/bin/SI_logs/$2/STREAM_$STREAM_PID

     

    • Create the bpend_notify.policy script as follows.

          =====================================

    MAILX="/bin/mailx"
    MAIL_ADDR="backup-admin@xyz.com"
    DIR=/usr/openv/netbackup/bin/SI_logs/$2
    rm -rf $DIR/STREAM_$STREAM_PID

    logger -t "backup:$2 Removed file with PID $STREAM_PID "

    if [ "$(ls -A $DIR)" ]; then
        STREAM_RUNNING=`ls -l $DIR | egrep -c '^-'`
        logger -t backup:byron80  "$STREAM_RUNNING Backup Streams still running"
    else
        #echo "$DIR is Empty"
        logger -t backup:byron80 "All Streams completed"
        RES=`/usr/openv/netbackup/bin/admincmd/bpplinfo $2 -modify -inactive 2>&1`
        if [ $? -ne 0 ]
        then
          logger -t "backup:$2:$RES"
          $MAILX -s "$2 : Deactivation Failed" "$MAIL_ADDR"
        else
          logger -t backup:byron80 "Policy $2 deactivated"
          $MAILX -s "$2 : Deactivated successfully" "$MAIL_ADDR"
        fi
    fi

     

         =====================================

    •  You can add the following lines in netbackup start script to clear the lock files if any during service startup.

               You can just add before the stop logic starts.

                #Added by Satish to clear up lock files for any previously hung jobs. 12-April-2012
                #for i in $(ls -l /usr/openv/netbackup/bin/SI_logs |grep ^d| cut -f9 -d" ")
                for i in $(find /usr/openv/netbackup/bin/SI_logs/* -type d)
               do
                      echo "Clearing up $i for any lock files"
                  
                      rm -f $i/*
                      done

                   ;;
          stop)     <-- Reference to insert in script

     

     

     Hope the forum finds it helpful.

     

    • Dont have any pre-made but there are actually 2 things you can do.

      Firstly you can use parent_start_notify.bat and parent_end_notify.bat. These run on the Master Server so you would want them to be specific you your clients policy - so parent_start_notify.yourpolicyname.bat.

      You will also need to make all command work across the network to do what ever you need on your client.

      If you want to use them on your client then you can add to your bpstart_notify.bat something like:

      @echo number %stream_number% >> "c:\program files\veritas\netbackup\bin\bpstart.log"
      @echo count %stream_count% >> "c:\program files\veritas\netbackup\bin\bpstart.log"
      @echo pid %stream_pid% >> "c:\program files\veritas\netbackup\bin\bpstart.log"
      @echo ============================================== >> "c:\program files\veritas\netbackup\bin\bpstart.log"

      Which will write to a log file something like this:

      number 1

      count 1

      pid 6996

      ==============================================

      As you should know how many streams you will run you need to have you bpend_notify.bat to check to see if the "number" has reached your set value

      Hope this helps

    • Thanks Mark for your response. I'll try to use your suggestion and built the script in next 2 days.

      Once ready will share it over here for others to use.

      Really appreciate all your suggestion.

      Thanks!

      Satkay

    •  

      • Created a folder to contain LOCK files for each policy. Each policy to have separate folder 

                  /usr/openv/netbackup/bin/SI_logs/Byron804_SI_Byron80_db

      • Create lock file for each triggered backup job for policy in its respective folder

                Added the following line in bpstart_notify on media server

                OUTF=/usr/openv/netbackup/bin/SI_logs/$2/STREAM_$STREAM_PID

       

      • Create the bpend_notify.policy script as follows.

            =====================================

      MAILX="/bin/mailx"
      MAIL_ADDR="backup-admin@xyz.com"
      DIR=/usr/openv/netbackup/bin/SI_logs/$2
      rm -rf $DIR/STREAM_$STREAM_PID

      logger -t "backup:$2 Removed file with PID $STREAM_PID "

      if [ "$(ls -A $DIR)" ]; then
          STREAM_RUNNING=`ls -l $DIR | egrep -c '^-'`
          logger -t backup:byron80  "$STREAM_RUNNING Backup Streams still running"
      else
          #echo "$DIR is Empty"
          logger -t backup:byron80 "All Streams completed"
          RES=`/usr/openv/netbackup/bin/admincmd/bpplinfo $2 -modify -inactive 2>&1`
          if [ $? -ne 0 ]
          then
            logger -t "backup:$2:$RES"
            $MAILX -s "$2 : Deactivation Failed" "$MAIL_ADDR"
          else
            logger -t backup:byron80 "Policy $2 deactivated"
            $MAILX -s "$2 : Deactivated successfully" "$MAIL_ADDR"
          fi
      fi

       

           =====================================

      •  You can add the following lines in netbackup start script to clear the lock files if any during service startup.

                 You can just add before the stop logic starts.

                  #Added by Satish to clear up lock files for any previously hung jobs. 12-April-2012
                  #for i in $(ls -l /usr/openv/netbackup/bin/SI_logs |grep ^d| cut -f9 -d" ")
                  for i in $(find /usr/openv/netbackup/bin/SI_logs/* -type d)
                 do
                        echo "Clearing up $i for any lock files"
                    
                        rm -f $i/*
                        done

                     ;;
            stop)     <-- Reference to insert in script

       

       

       Hope the forum finds it helpful.