Forum Discussion

steve14's avatar
steve14
Level 3
14 years ago
Solved

Triggering a backup from a NetBackup client

Hello, We are looking for options on triggering backups from NetBackup clients. At this point UNIX/LINUX clients. I've been digging the the Admin Guide vol1/2 and the NetBackup_Commands.pdf. From what I've read so far it looks like the bpbackup command can be used? What we are looking to do is to trigger a backup from a script after certain conditions are met. If anyone could share their experience and, or point me to any documentation that details the options I'd greatly appreciate it. Thanks in advance for your time.

  • 1) you must create a policy in netbackup; this server must be a client of that policy; and the poilcy must have a USER Schedule.  (more than one if you want two or more different retetions)

         the User schedule can be set for 24x7 or for only a smaller window - if say you have a Monday window of 8 pm to 10 pm then the job from the client - if it tries to run be for 8 pm will dies, if it tries to run after 10 pm will die - if it tires to run at 9 pm it will work.

    2) create your script and get all the correct stuff into it

         as you say you are working on a condition - the script would start with what you want - do a verify check in the script that it is at the correct condition - then do your backup - for this you are going to want to do some special things if you have different retentions - in that case you want to check your "day" and then pick the correct user schedule to use.  and redirect to a file if you want and email that when done maybe?

    3) create your cronentry

    (below example is aix)

    #Set schedule for retention level in Netbackup

    CURRDT=`date +%a`

    CUDHR=$(date +"%H")

    if [ $CUDHR -lt 17 -a $CURRDT = "Fri" ]

    then

    CURRDT="Thu"

    fi

    if [ "$CURRDT" = "Fri" ] || [ "$CURRDT" = "Sat" ] || [ "$CURRDT" = "Sun" ];then

    VERSCHED=UserFull

    else

    VERSCHED=Userincr

    fi

    <installpath>/bpbackup -p <yourpolicyname> -s ${VERSCHEDL} -h $(hostname) - S <masterserver> -t <policytype#> -w  ${BKUPDEV}

    if [[ $? -ne 0 ]]

    then

    print "NetBackup backup of ${BKUPDEV} failed."

    else

    print "NetBackup Backup completed."

    fi

     

    change and test as needed for your environment.

     

    EDIT:  I missed the  -w  ${BKUPDEV}

    that can be a variable you set up or just -w and the path you want to backup.

8 Replies

  • To trigger the firing of one of your polcies is the easiest way of doing it

    Use:

    bpbackup -h clientname -p policyname -s schedulename -S masterservername

    Add the -w to the end if you want your script to wait until it has completed

    Add -L to pipe the details out to a log file

    Make sure the account triggering the command has enough rights to do the backup

    Hope this helps

  • What data types do you need backup of  - flat files or database ?

    Where will the script be run - on the master server or client ?

    If you on the master server do:

    bpbackup -i p POLICY_NAME -s SCHEDLE_NAME -h CLIENT_NAME 

    it will fire off a backup off the client as if it was the Netbackup scheduler that did it. If you need the return code of the backup add -w. The "man" of bpbackup has some good examples.

    update: 35 seconds to late ....

  • The script will be run on the client. It will not be backing up the database. It will be backing up files that are written by the database.

    There will be a cron job on the client that will look for a done file, once it finds the done file it will issue the bpbackup command to initiate the backup.

    I'll go check out the man of bpbackup.

    Thanks for the advice and help you've provided.

  • Glad to have helped - the command i gave earlier can be triggered from the client - if you have issues add the client to the Master Servers Server list in its host properties to ensure full rights to trigger backups.

    Dont forget to close the thread by marking a solution once you have the answer you need and are happy that it works

  • Thank you very much for sharing your expertise and taking the time to reply. I really do appreciate it. I'll work on getting this tested and reply back with the results.

  • 1) you must create a policy in netbackup; this server must be a client of that policy; and the poilcy must have a USER Schedule.  (more than one if you want two or more different retetions)

         the User schedule can be set for 24x7 or for only a smaller window - if say you have a Monday window of 8 pm to 10 pm then the job from the client - if it tries to run be for 8 pm will dies, if it tries to run after 10 pm will die - if it tires to run at 9 pm it will work.

    2) create your script and get all the correct stuff into it

         as you say you are working on a condition - the script would start with what you want - do a verify check in the script that it is at the correct condition - then do your backup - for this you are going to want to do some special things if you have different retentions - in that case you want to check your "day" and then pick the correct user schedule to use.  and redirect to a file if you want and email that when done maybe?

    3) create your cronentry

    (below example is aix)

    #Set schedule for retention level in Netbackup

    CURRDT=`date +%a`

    CUDHR=$(date +"%H")

    if [ $CUDHR -lt 17 -a $CURRDT = "Fri" ]

    then

    CURRDT="Thu"

    fi

    if [ "$CURRDT" = "Fri" ] || [ "$CURRDT" = "Sat" ] || [ "$CURRDT" = "Sun" ];then

    VERSCHED=UserFull

    else

    VERSCHED=Userincr

    fi

    <installpath>/bpbackup -p <yourpolicyname> -s ${VERSCHEDL} -h $(hostname) - S <masterserver> -t <policytype#> -w  ${BKUPDEV}

    if [[ $? -ne 0 ]]

    then

    print "NetBackup backup of ${BKUPDEV} failed."

    else

    print "NetBackup Backup completed."

    fi

     

    change and test as needed for your environment.

     

    EDIT:  I missed the  -w  ${BKUPDEV}

    that can be a variable you set up or just -w and the path you want to backup.