[Veritas-bu] printing all schedules
2001-11-16 12:31:36
Subject: |
[Veritas-bu] printing all schedules |
From: |
veritas AT ratgut DOT com (Peter DrakeUnderkoffler) |
Date: |
Fri, 16 Nov 2001 12:31:36 -0500 |
This is a multi-part message in MIME format.
--------------47DB81C2CF9DE5B50664AC5C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
"David A. Chapa" wrote:
>
> Try playing around with
>
> $ADMCMD/bpcllist -allclasses [-L, -l, -U]
>
> With some creative scripting, you should be able to get what you are looking
> for.
>
> David
>
> <><><><><><><><><><><><><><><><><><><><>
> David A. Chapa
> NetBackup Consultant
> DataStaff, Inc.
> http://www.consulting.datastaff.com
> 847 413 1144
> ---------------------------------------
> NBU-LSERV AT datastaff DOT com - Adv. Scripting
> http://www.xbpadm-commands.com
>
> -----Original Message-----
> From: veritas-bu-admin AT mailman.eng.auburn DOT edu
> [mailto:veritas-bu-admin AT mailman.eng.auburn DOT edu]On Behalf Of Jeff
> Kennedy
> Sent: Friday, November 16, 2001 9:26 AM
> To: NBU List
> Subject: [Veritas-bu] printing all schedules
>
> Is there a way to printout the schedules for all classes? It is a real
> pain playing click-monkey through the java gui for every class and every
> schedule.
>
> Thanks.
> --
> =====================
> Jeff Kennedy
> Unix Administrator
> AMCC
> jlkennedy AT amcc DOT com
> _______________________________________________
> Veritas-bu maillist - Veritas-bu AT mailman.eng.auburn DOT edu
> http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu
>
> _______________________________________________
> Veritas-bu maillist - Veritas-bu AT mailman.eng.auburn DOT edu
> http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu
I put such a script together for the same reasons. I have mine run in a
cron
once a week. The script requires an e-mail address.
Thanks
peter
--------------47DB81C2CF9DE5B50664AC5C
Content-Type: application/x-sh;
name="nbuclass_sched.sh"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="nbuclass_sched.sh"
#!/bin/sh
#
# $Id: nbuclass_sched.sh,v 1.3 2001/10/22 14:00:02 root Exp $
#
# Script to run every so often to e-mail out the current schedule
# and state of all configured classes
# Make sure we have email address past to us
if [ $# -lt 1 ] ; then
printf "no email address specified\n"
printf "usage: $0 email_address\n\n"
exit 1
fi
# Now make sure we are running this on a NetBackup master
if [ -r /opt/openv/netbackup/bin/admincmd/bplicense ] ; then
/opt/openv/netbackup/bin/admincmd/bplicense
if [ $? -ne 0 ] ; then
printf "NetBackup is not setup properly on this systems\n"
printf " not running and exiting\n"
exit 1
fi
else
printf "This is not a NetBackup master system\n"
exit 1
fi
# Variables
OUTDIR=/var/tmp/nbusched_`date "+%m%d%Y%S"`
INACTIVE=${OUTDIR}/inactive
ACTIVE=${OUTDIR}/active
OUTFILE=${OUTDIR}/mailout
EMAIL_ADDR=$1
HERE=`pwd`
bpcllist=/opt/openv/netbackup/bin/admincmd/bpcllist
bpclsched=/opt/openv/netbackup/bin/admincmd/bpclsched
###
# Routine to cleanup
clean_up () {
echo "removing temp dir"
rm -rf ${OUTDIR}
}
###
# Routine to check for inactive classes
inactive_class () {
printf "### The following classes are inactive ###\n\n" >> $OUTFILE
cd /usr/openv/netbackup/db/class
grep 'ACTIVE 1' */info | awk -F/ '{print $1}' >> $INACTIVE
cat $INACTIVE >> $OUTFILE
printf "\nNOTE:\n\tYou may want to check and make sure you don't want
to activate them\n" >> $OUTFILE
}
###
# Routine to create the data
printout_schedule () {
for class in `${bpcllist}` ; do
${bpclsched} $class -U -label Full | sed '/^$/d' >
${OUTDIR}/${class}.Full
${bpclsched} $class -U -label Differential-Inc | sed '/^$/d' >
${OUTDIR}/${class}.Inc
done
}
###
# Routine to create the tables and sort them
create_schedlist () {
LIST=$1
SCHEDTYPE=$2
for class in `cat ${LIST}` ; do
eval cat ${class}.${SCHEDTYPE} \
| egrep
'Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday' \
| sed 's/ \{8\}/'"$class"' /' \
| sed -e 's/Sunday/0_Sunday/' \
-e 's/Monday/1_Monday/' \
-e 's/Tuesday/2_Tuesday/' \
-e 's/Wednesday/3_Wednesday/' \
-e 's/Thursday/4_Thursday/' \
-e 's/Friday/5_Friday/' \
-e 's/Saturday/6_Saturday/'
done
}
sort_output () {
LIST=$1
SCHEDTYPE=$2
cat ${OUTDIR}/tmp | sort -k 2.1,3 \
| sed 's/[0123456]_//g' \
| awk '{printf "%-20s %+10s %s %s %9s %-s\n", $1, $2, $3, $4, $5,
$6}'
}
### The actual Program ##
# Make the directory
mkdir $OUTDIR
cat /dev/null > ${ACTIVE}
cat /dev/null > ${INACTIVE}
cat /dev/null > ${OUTFILE}
printf "#### Veritas NetBackup Schedule info for Brodeur WorldWide ###\n\n" >>
$OUTFILE
# Call the routine to check inactivity
inactive_class
# Create the active list
for item in `cat ${INACTIVE}` ; do
TEMP="${item},"
done
TEMP=`echo $TEMP |sed -e 's/^,//' -e 's/,$//' -e 's/,/|/g'`
${bpcllist} | eval egrep -v '"$TEMP"' > ${ACTIVE}
# Call routine to print all the schedules
printout_schedule
cd ${OUTDIR}
# Call routine to print full schedule of class
#cat /dev/null > ${OUTDIR}/tmp
create_schedlist ${ACTIVE} Full > ${OUTDIR}/tmp
sort_output ${ACTIVE} Full > ${ACTIVE}.Full
# Call routine to print incemental schedule of class
#cat /dev/null > ${OUTDIR}/tmp
create_schedlist ${ACTIVE} Inc > ${OUTDIR}/tmp
sort_output ${ACTIVE} Inc > ${ACTIVE}.Inc
# Call routine to print full schedule of inactive classes
#cat /dev/null > ${OUTDIR}/tmp
create_schedlist ${INACTIVE} Full > ${OUTDIR}/tmp
sort_output ${INACTIVE} Full > ${INACTIVE}.Full
# Call routine to print incemental schedule of inactive classes
#cat /dev/null > ${OUTDIR}/tmp
create_schedlist ${INACTIVE} Inc > ${OUTDIR}/tmp
sort_output ${INACTIVE} Inc > ${INACTIVE}.Inc
cat << EOF >> $OUTFILE
#################################################
############### Schedules #######################
- - - Active Full - - -
`cat ${ACTIVE}.Full`
- - - Inactive Full - - -
`cat ${INACTIVE}.Full`
- - - Active Incremental - - -
`cat ${ACTIVE}.Inc`
- - - Inactive Incremental - - -
`cat ${INACTIVE}.Inc`
EOF
cat ${OUTFILE} | mailx -s "NetBackup Schedule Summary from `hostname` :^)"
${EMAIL_ADDR}
cd $HERE
clean_up
--------------47DB81C2CF9DE5B50664AC5C--
|
|
|