/[smecontribs]/rpms/smeserver-affa/contribs7/smeserver-affa-0.9.0-trapsignals.patch
ViewVC logotype

Contents of /rpms/smeserver-affa/contribs7/smeserver-affa-0.9.0-trapsignals.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Mon Mar 10 20:29:34 2008 UTC (16 years, 2 months ago) by slords
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
Import on branch contribs7 of package smeserver-affa-0.10.0-0.el4.sme.src.rpm

1 --- smeserver-affa-0.9.0/root/sbin/e-smith/affa.trapsignals 2008-03-09 12:22:22.000000000 +0100
2 +++ smeserver-affa-0.9.0/root/sbin/e-smith/affa 2008-03-09 13:15:31.000000000 +0100
3 @@ -2490,6 +2490,12 @@
4
5 my $affastatus = esmith::DB::db->open("/home/e-smith/db/affa-report/$jobname");
6 my $size=$affastatus->get_prop( $archive, 'TotalFileSize' ) || 0;
7 + if( not $size )
8 + {
9 + updateReportDB();
10 + $affastatus = esmith::DB::db->open("/home/e-smith/db/affa-report/$jobname");
11 + $size=$affastatus->get_prop( $archive, 'TotalFileSize' ) || 0;
12 + }
13 $size =~ s/(\d*).*/$1/;
14 my $f;
15 my $restore_list='';
16 --- smeserver-affa-0.9.0/root/usr/lib/affa/create-backup-file.sh.trapsignals 2008-03-09 12:24:13.000000000 +0100
17 +++ smeserver-affa-0.9.0/root/usr/lib/affa/create-backup-file.sh 2008-03-09 13:13:41.000000000 +0100
18 @@ -14,36 +14,58 @@
19 BASENAME=`basename $OUTFILE`
20 SIZE=$6
21
22 -PIPE=/tmp/affa.$$.$(date +%s)
23 -mkfifo $PIPE
24 +
25 +errorexit()
26 + {
27 + STATUS=$?
28 + if [ ! -z $1 ] ; then
29 + STATUS=$1
30 + fi
31 + echo
32 + test -f $OUTFILE && rm -f $OUTFILE
33 + rm -f $OUTFILE.md5sum $PIPE
34 + exit $STATUS
35 + }
36 +
37 +verifyint()
38 + {
39 + echo "Verify terminated by user"
40 + rm -f $OUTFILE.md5sum $PIPE
41 + exit 0
42 + }
43 +
44 +trap errorexit SIGTERM SIGINT ERR
45
46 echo "Writing $OUTFILE"
47 -(md5sum < $PIPE & /bin/tar -C $ROOTDIR/$JOB/$ARCHIVE -cf - $RESTORE | /usr/bin/pv -i 0.3 -s $SIZE | /bin/gzip | tee $PIPE > $OUTFILE) > $OUTFILE.md5sum
48 +PIPE=/tmp/affa.$$.$(date +%s)
49 +rm -f $PIPE
50 +mkfifo $PIPE
51 +(md5sum < $PIPE & /bin/tar -C $ROOTDIR/$JOB/$ARCHIVE -cf - $RESTORE | /usr/bin/pv -i 0.3 -s $SIZE | /bin/gzip --fast | tee $PIPE > $OUTFILE) > $OUTFILE.md5sum
52
53 STATUS=$?
54 if [ $STATUS != 0 ] ; then
55 - test -f $OUTFILE && rm -f $OUTFILE
56 - rm -f $OUTFILE.md5sum $PIPE
57 - exit $STATUS
58 + errorexit $STATUS
59 fi
60
61 -GSIZE=$(find $OUTFILE -printf "%s")
62 +trap verifyint SIGTERM SIGINT
63 +
64 +rm -f $PIPE
65
66 -CR=$(echo "scale=5; $SIZE/$GSIZE" | bc)
67 -SPACESAVING=$(echo "scale=5; 100-$GSIZE/$SIZE*100" | bc)
68 -printf "Compression Ratio: %.1f (%.1f %%)\n" $CR $SPACESAVING
69 +GSIZE=$(find $OUTFILE -printf "%s")
70 +if [ $SIZE -gt 0 ] ; then
71 + CR=$(echo "scale=5; $SIZE/$GSIZE" | bc)
72 + SPACESAVING=$(echo "scale=5; 100-$GSIZE/$SIZE*100" | bc)
73 + printf "Compression Ratio: %.1f (%.1f %%)\n" $CR $SPACESAVING
74 +fi
75
76 -echo "Verifying $OUTFILE"
77 +echo "Verifying $OUTFILE (hit CTRL-C to skip)"
78 cat $OUTFILE | /usr/bin/pv -i 0.1 -s $GSIZE | md5sum --status -c $OUTFILE.md5sum
79 STATUS=$?
80 if [ $STATUS != 0 ] ; then
81 echo "Verify FAILED"
82 - test -f $OUTFILE && rm -f $OUTFILE
83 - rm -f $OUTFILE.md5sum $PIPE
84 - exit $STATUS
85 + errorexit $STATUS
86 fi
87
88 cat $OUTFILE.md5sum | sed -e s/-/$BASENAME/ > $OUTFILE.md5sum
89
90 -rm -f $PIPE
91 exit 0

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed