Forum Discussion
7 Replies
- mph999Level 6bpend may actually be more successful ... If you look at the template file (in goodies dir I think) you will see NBU passes various vaules: $1 $2 $3 $4 and $5 The script shows what they are, one is the client name, another the policy name and one the exit status eg If you make a blank script, with the correct name that just contains: echo $1 echo $2 etc ... it will print out the values when the script ends. If the exit status is non zero, then you just alert on this.
- TekkaliLevel 4
Hi
Thanks for response
Yes It's in goodies
Please give me more details, I am not that much familiar in script.
Provide with ex and compleet script..
In my server bpend_notify script output provided below
# more bpend_notify
#! /bin/sh
# $Header: bpend_notify.sh,v 1.3 2003/08/13 14:11:54 $
#
#bcpyrght
#***************************************************************************
#* $VRTScprght: Copyright 1993 - 2012 Symantec Corporation, All Rights Reserved $ *
#***************************************************************************
#ecpyrght
#
# bpend_notify.sh
#
# This script is called by NetBackup when bpbkar is finished doing a
# backup on the client. It is also called after backing up the files
# for a user directed archive, but before the files are deleted.
#
# This script:
# receives 5 parameters: CLIENTNAME POLICYNAME SCHEDNAME SCHEDTYPE STATUS
# must be executable by the root user
# should exit with 0 upon successful completion
#
# If this script will not complete within a few seconds, you should set
# the BPEND_TIMEOUT in the /usr/openv/netbackup/bp.conf file on the server.
# You should also be aware that the time taken by this script will slow
# down other backups that are waiting for this client to complete.
#
# This script should be installed with mode 555 so that user directed
# backups and archives will be able to execute this script.
#
# CAUTION: writing anything to stdout or stderr will cause backup problems
#
# --------------------------------------------------------------------
# main script starts here
# --------------------------------------------------------------------
umask 022
if [ "$#" -ne 5 ]
then
exit 1
fi
if [ "$4" = "FULL" -o "$4" = "INCR" -o "$4" = "CINC" ]
then
OUTF=/usr/openv/netbackup/bin/BPEND_CALLED
# 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
case "$4"
in
"FULL")
echo `date` full backup finished on $1 - policy $2 schedule $3. Exit status = $5 >> $OUTF
;;
"INCR")
echo `date` differential incremental backup finished on $1 - policy $2 schedule $3. Exit status = $5
>> $OUTF
;;
"CINC")
echo `date` cumulative incremental backup finished on $1 - policy $2 schedule $3. Exit status = $5 >>
$OUTF
;;
esac
#
# might want to mail this info to someone
#
# cat $OUTF | mail -s "NetBackup backup finished" someone_who_cares
#
# CAUTION: some platforms do not allow the -s parameter on mail
#
fi
exit 0 - TekkaliLevel 4
Hi
Ignore previous one
two files create one is for policy list mention all critical list "critical_policy_list "
Critical Policies Failed out put file Critical_Backup_Failures. but still not working check and suggest any thing wrong in script
# more /usr/openv/netbackup/bin/backup_exit_notify
#! /bin/sh
# $Header: backup_exit_notify.sh,v 1.4.28.1 2009/11/10 15:57:19 $#bcpyrght
#***************************************************************************
#* $VRTScprght: Copyright 1993 - 2009 Symantec 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 7 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
# DONE_TRYING - 0=will retry, 1=done, will not retry.
# must be executable by the root user
# should exit with 0 upon successful completionOUTF=/usr/openv/netbackup/bin/BACKUP_EXIT_CALLED
# --------------------------------------------------------------------
# main script starts here
# --------------------------------------------------------------------umask 022
dateStr=`date`
if [ "$#" -lt 7 ]
then
echo ${dateStr} "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
fiif [ ! -f $OUTF ]
then
touch $OUTF
fiecho ${dateStr} "-----------------------------" >> $OUTF
echo ${dateStr} " CLIENT: $1" >> $OUTF
echo ${dateStr} " POLICY: $2" >> $OUTF
echo ${dateStr} " SCHEDULE: $3" >> $OUTF
echo ${dateStr} "SCHEDULE TYPE: $4" >> $OUTF
echo ${dateStr} " STATUS: $5" >> $OUTF
echo ${dateStr} " STREAM: $6" >> $OUTF
echo ${dateStr} " DONE_TRYING: $7" >> $OUTF
echo ${dateStr} "-----------------------------" >> $OUTF#
# might want to mail this info to someone
#
date=`date`
cat /usr/openv/netbackup/scripts/Report/critical_policy_list |grep -i $2
if [[ $? -eq 0 && $5 -gt 1 && $5 -ne 150 ]];then
echo "Backup failed for $2" >>/usr/openv/netbackup/scripts/Report/Critical_Backup_Failures
fi
# cat $OUTF | mail -s "NetBackup backup exit" someone_who_caresexit 0
- mph999Level 6
the script above is only an example, none of if it is actually needed. The only requirement for bpend notify scripts is that it has the correct name.
The above does show the paramateres available.
# 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
# DONE_TRYING - 0=will retry, 1=done, will not retry.therefore,
a script that contains only:
echo "Client = $1" >/tmp/$1_log.txt
echo "Policy = $2" >>/tmp/$1_log.txt
echo "Schedule = $3" >>/tmp/$1_log.txt
echo "Status = $5" >>/tmp/$1_log.txtIs a start ...
And produces this output when a job finishes in a file called /tmp/<client>_log.txt
Client = womble
Policy = womble_sp1
Schedule = full
Status = 0 - TekkaliLevel 4
above script gives only one policy or one client status provided. I need multiple critical policies schedule or Manuval backups status at a time.
above I provided
more /usr/openv/netbackup/bin/backup_exit_notify. in that created one file in that mentioned all critical polices and once backups completed output will save in singe file.
date=`date`
cat /usr/openv/netbackup/scripts/Report/critical_policy_list |grep -i $2
if [[ $? -eq 0 && $5 -gt 1 && $5 -ne 150 ]];then
echo "Backup failed for $2" >>/usr/openv/netbackup/scripts/Report/Critical_Backup_Failures
fi
# cat $OUTF | mail -s "NetBackup backup exit" someone_who_caresexit 0
Please check and suggest ....
- mph999Level 6Have you tried the script, does it work ? I'm not logged on to any servers at the moment and can't until later as I don't have my laptop with me.
- jim_daltonLevel 6
Theres potentially a lot of drudgery there unless theres only a handful of hosts/policies...why not use opscenter?Thats one of its many roles and its a zero cost option.
Jim
Related Content
- 10 years ago
- 10 years ago
- 10 years ago
- 4 years ago
- 10 years ago