Listing 6: report.bu v2.0--fast backup utility
1 # @(#) Listing 6 report.bu v2.0 Fast Backup Utility
2 # Author: Jon Alder/Ed Schaefer
3 # This program reports on the statistics of the last fast.bu.
4 ###############################################################################
5 # Set the few working variables we need.
6 CONFIG=/usr/bu/config ;export CONFIG
7 WORKING_DIR=`grep working_dir $CONFIG|cut -d : -f2` ;export WORKING_DIR
8 ###############################################################################
9 # Initalize files.
10 ###############################################################################
11 cd /
12 cat /dev/null>$WORKING_DIR/tape.report
13 ###############################################################################
14 # The reporting section.
15 ###############################################################################
16 cat $WORKING_DIR/tape.time
17 echo "\n\n"
18 cat $WORKING_DIR/tape.BLOCKS | awk '
19 {
20 {
21 dd = dd + 1;
22 sum = sum + ($7 * .000512) + 1;
23 printf("%18s %12d\n", $2, ($7 * .000512) + 1);
24 }
25 }
26 END {printf("%28s \n"," ------------");
27 printf("%d%9s %10d %s\n",dd, " Tape Sections ", sum, "Total Megabytes
writen in this backup.")
28 }'>>$WORKING_DIR/tape.report
29 cat $WORKING_DIR/tape.dur | awk '
30 {
31 {
32 time1 = ($1 * 1440) + ($2 * 60) + $3;
33 getline;
34 time2 = ($1 * 1440) + ($2 * 60) + $3;
35 sum = (time2 - time1) / 60;
36 }
37 }
38 END {printf("%17s %13f %s\n"," ", sum, "Total hours for this backup.")
39 }'>>$WORKING_DIR/tape.report
40 grep Total $WORKING_DIR/tape.report > $WORKING_DIR/tape.rate
41 cat $WORKING_DIR/tape.rate | awk '
42 {
43 {
44 megs = $4;
45 getline;
46 time = $1;
47 rate = megs / time;
48 }
49 }
50 END {printf("%17s %13f %s\n"," ", rate, "Average MEG/hour for this
backup.")
51 }'>>$WORKING_DIR/tape.report
52 ###############################################################################
53 # Output report
54 cat $WORKING_DIR/tape.report
|