Create a Shell Script to Initiate the Backups
It is also important that the second-stage backup of the NetBackup catalogs occurs directly after the first-stage backup. A good way to ensure this is to write a script that initiates both backups, one after the other.
Example Catalog-backup Script
#!/bin/sh
#
# catalog_backup script
#
# Performs a two-stage backup of the NetBackup catalogs
#
POLICY=nbu_cat_backup # Change to the name of the correct policy
SCHED=full_backup # Change to the name of the correct schedule
LOGDIR=/usr/openv/netbackup/logs/catalog_backup
if [ -d $LOGDIR ]; then
exec >> $LOGDIR/log.`date "+%m%d%y"` 2>&1
else
exec > /dev/null 2>&1
fi
echo "Running first stage catalog backup"
/usr/openv/netbackup/bin/bpbackup –w –i –c $POLICY –s $SCHED
EXIT_STAT=$?
if [ $EXIT_STAT –ne 0 ]; then
echo "First stage catalog backup failed ($EXIT_STAT)"
exit 1;
fi
echo "Running second stage catalog backup"
/usr/openv/netbackup/bin/admincmd/bpbackupdb
EXIT_STAT=$?
if [ $EXIT_STAT –ne 0 ]; then
echo "Second stage catalog backup failed ($EXIT_STAT)"
exit 1;
fi
exit 0;
|