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 t...
  • Satkay_Satish's avatar
    13 years ago

     

    • 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.