cancel
Showing results for 
Search instead for 
Did you mean: 

Sharing Useful Unix/Linux Shell Commands

rmcc4444
Level 2

I recently got re-assiged to the Backup/SAN team at my company.  I've only been doing NB for a few weeks but here are a few commands I've copied off the net or created myself that save me time.  I'll post more if there is interest.  Anyone else want to share?

--

Backup Status

/usr/openv/netbackup/bin/admincmd/bperror -U -backstat -s info -d mm/dd/yy hh:mm:ss -e mm/dd/yy hh:mm:ss

Client Backups

/usr/openv/netbackup/bin/admincmd/bpimagelist -A -d mm/dd/yy hh:mm:ss -e mm/dd/yy hh:mm:ss

Problems

/usr/openv/netbackup/bin/admincmd/bperror -U -problems -d mm/dd/yy hh:mm:ss -e mm/dd/yy hh:mm:ss

All Log Entries

/usr/openv/netbackup/bin/admincmd/bperror -U -all -d mm/dd/yy hh:mm:ss -e mm/dd/yy hh:mm:ss

Media List

/usr/openv/netbackup/bin/admincmd/bpmedialist -U -mlist

Media Contents

/usr/openv/netbackup/bin/admincmd/bpmedialist -U -mcontents -ev <media id>

Images On Media

/usr/openv/netbackup/bin/admincmd/bpimmedia -U -mediaid <media id>

 Media Log Entries

/usr/openv/netbackup/bin/admincmd/bperror -U -media -d mm/dd/yy hh:mm:ss -e mm/dd/yy hh:mm:ss

 Media Summary

/usr/openv/netbackup/bin/admincmd/bpmedialist -summary

Media Written

/usr/openv/netbackup/bin/admincmd/bpimagelist -A -media -d mm/dd/yy hh:mm:ss -e mm/dd/yy hh:mm:ss

For a list of scheduled backups, you can use

/usr/openv/netbackup/bin/admincmd/nbpemreq -predict -date <mm/dd/yyyy>

Start SLPs

for SLPS in SLP1 SLP2 SLP3 SLP4; do /usr/openv/netbackup/bin/admincmd/nbstlutil active -lifecycle slp-${SLPS} ; done

Stop SLPS

for SLPS in SLP1 SLP2 SLP3 SLP4; do /usr/openv/netbackup/bin/admincmd/nbstlutil inactive -lifecycle slp-${SLPS} ; done
 

Show pending SLP jobs

for SLPS in SLP1 SLP2 SLP3 SLP4; do /usr/openv/netbackup/bin/admincmd/nbstlutil active -lifecycle slp-$SLPS ;echo"" ; echo "**** slp-$SLPS ****"; nbstlutil report -lifecycle slp-$SLPS | grep $SLPS ; /usr/openv/netbackup/bin/admincmd/nbstlutil inactive -lifecycle slp-$SLPS ; done

Show all clients in a departments policy

for policy in `sudo /usr/openv/netbackup/bin/admincmd/bppllist | grep -i department ; do echo ${policy}; sudo /usr/openv/netbackup/bin/admincmd/bpplclients ${policy}; echo; done

List scratch tapes available on robot 0 (physical)

vmquery -b -pn Scratch | grep -v HCART3 

List scratch tapes available on robot 1 (virtual)

vmquery -b -pn Scratch | grep -HCART3 

Count total number of scratch tapes available

/usr/openv/volmgr/bin/vmquery -pn Scratch | grep -c "robot slot"

List current drive paths that are down

/usr/openv/volmgr/bin/vmoprcmd | grep DOWN

 

--

bpimagelist -hoursago 360 -U -client client_name |awk '{file+=$4} {kb+=$5} END {print file" " kb}'

the above command will produce the report for last 15 days (24*15=360 hours) for client named client_name for files and kB backed up (all those whould be summed)

below command will gave you the used tapes for last 15 days for this client

bpimagelist -hoursago 360 -U -client client_name -media

A very useful reporting script here --> http://linuxshellaccount.blogspot.com/2009/06/netbackup-backup-report-script.html

Show jukebox info

vmchange -res -robot_info -verbose -rn 0 -rt TLD -rh <host>

Show job activity

/opt/openv/netbackup/bin/admincmd/bpdbjobs -report

Nbstatus

http://prefetch.net/blog/index.php/2009/11/30/getting-a-daily-status-report-from-your-netbackup-infr...

nbthroughput

http://prefetch.net/blog/index.php/2009/12/12/generating-netbackup-throughput-data-reports/

---

Edit the "/opt/openv/netbackup/bin/goodies/mail_bp_reports" script like so:

 

#!/bin/sh

# $Header: mail_bp_reports.sh,v 1.3 2004/01/15 15:35:01 $

MAILTO=youremail@address.com

 

Then on the lines with "mail_cmd", add $MAILTO at the end of the lines.  

 

cat $OUTFILE | mail_cmd "My Company's NetBackup backup status" $MAILTO

 

cat $OUTFILE1 | mail_cmd "My Company's  NetBackup problems log" $MAILTO

 

cat $OUTFILE2 | mail_cmd "My Company's NetBackup cleaning stats" $MAILTO

--

..after you've done that, when you run the "/opt/openv/netbackup/bin/goodies/mail_bp_report" script you should have 3 different reports sent to you.  If you like the data add it to a daily cron job.

 

 

 

 

 

2 REPLIES 2

AmolB
Moderator
Moderator
Employee Accredited Certified

Instead of a forum thread you may post the above as a BLOG.

rmcc4444
Level 2

Good idea. Let me clean it up a bit over the next few days then I'll use the blog.