Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Configure backup_exit_notify to duplicate a particular policy/schedule's backup upon backup exit.

Command Line

Configure backup_exit_notify to duplicate a particular policy/schedule's backup upon backup exit.

by  Qdog  Posted    (Edited  )

1. Add following lines to the /usr/openv/netbackup/bin/backup_exit_notify script after the 8 'echo' statements:
[color green]
############begin custom edits#############
if [ "$5" -gt 1 ]

then

exit 1

fi

######

if [ "$2" = "laptopTest" ]

then

/usr/openv/netbackup/bin/admincmd/bpduplicate -dstunit DSU_vault -dp NetBackup -client laptop -policy laptopTest -sl FullNoSched -hoursago 2 -rl 3 -fail_on_error 0 -set_primary 0 -primary -number_copies 1 -L /usr/openv/netbackup/logs/dup.log

fi
############end custom edits###############
[/color]
NOTE: The backup_exit_notify script is called by the bpsched process on the master upon the exit of any backup job. The first 4 lines exit the script if the job status is anything other than 0 or 1. The next line says if the policy name of the backup is 'laptopTest', then run a duplicate. The bpduplicate command specifies to make a copy of any images written in the last 2 hours for client 'laptop' in policy 'laptopTest' and schedule 'FullNoSched'.



Entire script:

#bcpyrght
#***************************************************************************
#* $VRTScprght: Copyright 1993 - 2003 VERITAS Software Corporation, All Rights Reserved $ *
#***************************************************************************
#ecpyrght

#
# backup_exit_notify.sh
#
# This script is called by the NetBackup scheduler, after an individual
# client backup has completed (including media closure and image db validation.
#
# NOTE: this script will always be run in "background" mode, meaning that
# the NetBackup scheduler will NOT wait for it's completion.
#
# This script:
# receives 5 parameters:
# CLIENT - the client hostname
# POLICY - the policy label
# SCHEDULE - the schedule label
# SCHEDULE_TYPE - the type of schedule: FULL INCR UBAK UARC
# STATUS - the backup status for this job
# STREAM - the backup stream number for this job
# must be executable by the root user
# should exit with 0 upon successful completion

OUTF=/usr/openv/netbackup/bin/BACKUP_EXIT_CALLED

# --------------------------------------------------------------------
# main script starts here
# --------------------------------------------------------------------

umask 022

if [ "$#" -lt 6 ]
then
echo `date` "backup_exit_notify expects at least 6 parameters: $*" >> $OUTF
exit 1
fi

# You may want to delete the output file elsewhere in order to
# accumulate successful backup information.
# If so, comment out the following 4 lines.
if [ -s $OUTF ]
then
/bin/rm -rf $OUTF
fi

if [ ! -f $OUTF ]
then
touch $OUTF
fi

echo `date` " POLICY: $2" >> $OUTF
echo `date` " SCHEDULE: $3" >> $OUTF
echo `date` "SCHEDULE TYPE: $4" >> $OUTF
echo `date` " STATUS: $5" >> $OUTF
echo `date` " STREAM: $6" >> $OUTF
echo `date` "-----------------------------" >> $OUTF

#
# might want to mail this info to someone
#
# cat $OUTF | mail -s "NetBackup backup exit" someone_who_cares
[color green]
############begin custom edits#############
if [ "$5" -gt 1 ]
then
exit 1
fi
######
if [ "$2" = "laptopTest" ]
then

/usr/openv/netbackup/bin/admincmd/bpduplicate -dstunit DSU_vault -dp NetBackup -client laptop -policy laptopTest -sl FullNoSched -hoursago 2 -rl 3 -fail_on_error 0 -set_primary 0 -primary -number_copies 1 -L /usr/openv/netbackup/logs/dup.log

fi
############end custom edits###############
[/color]
exit 0
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top