cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

RELEASE: Script to check last backup sizes

Hello all,

I needed a script to check the size of the last backup in a more
readable form. Thought I release it out here as well. The script also shows when certain backups are missing.
Have a look or use when interested. . Feedback appr.

best regards
Sander Beenen

-- 8< cut here ----------------
#! /bin/sh

# (c) 2005, Green Ants, Sander Beenen, sander@mail.com

# 8 Nov 2005 - Quick script to get the size of the LAST -type of backup in (default) the current month.
# Written, tested and in production on Solaris 9, NBU 5.1.
# Assumes root access and correct PATH setiings ;-)
# Could/can be expanded with month and client arg.

# check args for different type of backups
case "$1" in
-full)
TYPE="_FULL"
;;
-inc)
TYPE="_INC"
;;
-user)
TYPE="_UBAK"
;;
-arc)
TYPE="_UARC"
;;
*) echo "usage: $0 -full | -inc | -user | -arc"
exit 1
;;
esac

# set the current month to look for
MONTH=`date +%b`

# get all the clients from NBU
CLIENT_LIST=`bpclclients | awk '{print $3}'|tail +3`

# dummy awk for a nice output ;-)
echo foo | awk '{ printf "%24s %12s %10s %10s %12s\n", "Client","Date","Files","Size","Type" }'
echo foo | awk '{ printf "%24s %12s %10s %10s %12s\n", "------","----","-----","----","----" }'

# loop thru the list of clients
for CL in $CLIENT_LIST
do
echo $CL | awk '{printf "%24s", $1 }'

# get the list of backups and grep the last one of type TYPE...
bpcatlist -client $CL |grep $MONTH | grep $TYPE | head -1 | \
awk 'BEGIN { }
{ printf "%4d %3s %4s %10d %10s %12s", $3, $2, $5, $6, $7, $8 }
END { }'

# fake awk for een CR/LF
echo foo | awk '{printf "\n" }'
done

exit 0