SHIFT-WIKI

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


searchnbdb

Search NetBackup Database for File Existence

This is a script to search for certain files in the NetBackup database. You'll need a linux client with the netbackup client installed, you'll need to know the client(s) the files were stored on and to make the search a little faster, you'll need to know since which date you need to search.

#!/bin/bash
########################################################################################################################
# Author : Sjoerd Hooft
# Date Initial Version: 5 July 2012
# Comments: sjoerd_ @ _getshifting.com
#
# Description:
# This script can search the NetBackup database for specific files.
# It is meant for a one time usage.
#
# Recommendations:
# The script is designed for a 120 column terminal.
# The running user must be root.
#
# Changes:
# Please comment on your changes to the script (your name and email address, line number, description):
# DATE - USERNAME - EMAILADDRESS - CHANGE DESCRIPTION
########################################################################################################################
 
# Debug option; uncomment for debugging
# set -x
 
# Script Variables
HOSTNAME_SHORT=`hostname -s`
BASEDIR=`dirname $0`
WHATAMI=`basename $0`
LOGFILE="$BASEDIR/$WHATAMI.log"
DATE=`date +%Y%m%d`
# Highlight output on screen
#BOLD=`tput bold`
#BOLDOFF=`tput sgr0`
# Send all output to logfile; disable if screen output is needed
exec > $LOGFILE 2>&1
 
# Specific Script Variables
NBBIN="/usr/openv/netbackup/bin/"
NBMASTER="bcksrv01"
# Startdate should be last friday, how more in the past, the more time the script will take
STARTDATE="06/29/2012"
FILESERVERS="filesrv01 filesrv02 filesrv07 filesrv08 filesrv09"
FILELIST="file01.doc file02.docx file03.jpg"
 
# Start script
echo "Starting $WHATAMI on $DATE"
for server in $FILESERVERS; do
   echo ""
   echo "Starting searching in $server"
      for file in $FILELIST; do
      $NBBIN/bplist -S $NBMASTER -C $server -t 13 -s $STARTDATE -PI $file
      done
done
 
exit
searchnbdb.txt · Last modified: 2021/09/24 00:25 by 127.0.0.1