cancel
Showing results for 
Search instead for 
Did you mean: 

bpstart_notify

raviteli1
Level 3
Employee

*** Moved to new discussion from https://vox.veritas.com/t5/NetBackup/Wait-for-bpstart-notify-bat-before-backup-job-starts/m-p/327571

How do I send a 'continue' message from the script ?

I have tried following options but none of them seem to work.

echo "continue"

echo "continue" >&1

 

8 REPLIES 8

Marianne
Level 6
Partner    VIP    Accredited Certified

When the bpstart_notify script completes with status 0, the 'continue' message is automatically sent to bpbkar.

What is the purpose of bpstart_notify in your environment?

If you share the script and you explain what the expectation is, I am sure that someone here will be able to assist. 

I see. Is there a way to run this script for long ? We are trying out 2 stage backup; 1st stage is backing up our environment using our APIs and stage data in a local folder. 2nd stage will involve netbackup Unix Standard policy to backup these files from this location into NetBackup.

We need to do this two stage backup as we are trying out netbackup with a new product of ours. We have developed vddk-like APIs but netbackup currently doesn't have an implementation to invoke it directly.

Thanks,

Ravi

 

Here is my script

 

if [ "$4" = "FULL" -o "$4" = "INCR" -o "$4" = "CINC" ]
then
OUTF=/usr/openv/netbackup/bin/BPSTART_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 started on $1 - policy $2 schedule $3 >> $OUTF
while [ $retries -gt 0 ]
do
echo "continue" >&1
echo "\\n" >> $OUTF
echo "Sent out keep_alive to parent process" >> $OUTF
echo "Sleeping for 4 minutes" >> $OUTF
sleep 4m
retries=`expr $retries - 1`
echo "Pending retries:" $retries
done
echo Retried 2 times. Exiting >> $OUTF
;;
"INCR")
echo `date` differential incremental backup started on $1 - policy $2 schedule $3 >> $OUTF
;;
"CINC")
echo `date` cumulative incremental backup started on $1 - policy $2 schedule $3 >> $OUTF
;;
esac

#
# might want to mail this info to someone
#
# cat $OUTF | mail -s "NetBackup backup started" someone_who_cares
#
# CAUTION: some platforms do not allow the -s parameter on mail
#
fi

Marianne
Level 6
Partner    VIP    Accredited Certified

The default bpstart_notify timeout is 5 minutes. 

To increase the timeout is covered in the 7-year-old post where you initially tagged onto.

Please check your script outside of NBU. Check how long it takes to complete before increasing the timeout.

Another option would be to script everything on the client.
Get OS scheduler to start the script that will perform phase 1, and then when completed start 'bpbackup' command.
This will need a 'User backup' type schedule in the policy with open window during which client is allowed to run User backup. 

Marianne
Level 6
Partner    VIP    Accredited Certified

Maybe I am blind... but all I see is a 'sleep 4m'.

I was expecting to see commands or a script being called that would perform your '1st stage' backup?

I am still not invoking my product's backup APIs. I was just trying to find a way to see if I can run something beyond the timeout (of 5 minutes) by sending keep_alive message.

But it seems to me that only way to send keep_alive is by exiting with '0' as return value from the bpstart_notify script. I was wondering if I can keep looping around in the script and send a message every 4 minutes (within timeout limits) to the NBU saying that I am still working.

Will increasing timeout be a good option for me if its going to take me do 1st stage backup in 5-6 hrs ? 

 

Marianne
Level 6
Partner    VIP    Accredited Certified

Apologies, but I am no scripting expert...
Maybe @mph999 and @sdo can help here. 
I don't see your script going into a loop with a 'sleep 4m' each time.

Status 0 exit status sends 'continue' to bpbkar, meaning bpstart_notify is finished and bpbkar can now continue to backup what is in Backup Selection.

I do not recommend to use bpstart_notify for anything taking longer that 30 - 60 minutes.

Bear in mind that all resources are already allocated by the time bpstart script is called. 
Do you really want devices to be idle for 5-6 hours while your API script is running?

Best to run the procedure outside of NBU using OS scheduler or a 3rd-party scheduler.

sdo
Moderator
Moderator
Partner    VIP    Certified

@Marianne is right.  Try to restrict yourself to using bpstart_notify for short duration events like database stop - and bpend_notify for short events like database start.  If you configure long events and a long timeout then you will make it more difficult to detect real hangs and delays.

So, it sounds like an approach might be to:

1) Create a user mode backup policy.

2) Schedule a scripted event on client side - to do whatever API activity you need, and run an application backup, and then have that script call the bpbackup command to run the user mode backup policy.