Author: glen                         Date: Thu Apr  5 09:36:57 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- v0.5: remove target dir before making backup to tmp dir, avoiding double disk 
usage

---- Files affected:
packages/bacula-backup-mysql:
   bacula-backup-mysql (1.15 -> 1.16) , bacula-backup-mysql.spec (1.9 -> 1.10) 

---- Diffs:

================================================================
Index: packages/bacula-backup-mysql/bacula-backup-mysql
diff -u packages/bacula-backup-mysql/bacula-backup-mysql:1.15 
packages/bacula-backup-mysql/bacula-backup-mysql:1.16
--- packages/bacula-backup-mysql/bacula-backup-mysql:1.15       Fri Mar 16 
18:29:16 2012
+++ packages/bacula-backup-mysql/bacula-backup-mysql    Thu Apr  5 11:36:52 2012
@@ -57,13 +57,13 @@
 
 # process each cluster
 for my $cluster ($c->get('clusters', 'cluster')) {
-       print ">>> $cluster\n";
+       print ">>> cluster: $cluster\n";
        if ($cleanup) {
                cleanup_cluster($cluster);
        } else {
                backup_cluster($cluster);
        }
-       print "<<< $cluster\n";
+       print "<<< end cluster: $cluster\n";
 }
 
 #
@@ -76,16 +76,23 @@
        # i.e: include_database teensForum5./~(phorum_forums|phorum_users)/
        my ($database) = $db =~ /^([^\.]+)/;
 
-       print ">>>> mysqlhotcopy $db\n";
-
        my $dstdir = tempdir("bbm.XXXXXX", DIR => $tmpdir);
 
+       # remove output dir before backup,
+       # otherwise the disk space requirement would double
+       my $dirname = "$backup_dir/$cluster/$database";
+       if (-d $dirname) {
+               print ">>>> rmtree $dirname\n";
+               rmtree($dirname);
+       }
+
        # make backup with mysqlhotcopy
        my @shell = ('mysqlhotcopy');
        push(@shell, '-u', $user) if $user;
        push(@shell, '-p', $password) if $password;
        push(@shell, '-S', $socket) if $socket;
        push(@shell, $db, $dstdir);
+       print ">>>> mysqlhotcopy $database\n";
        system(@shell) == 0 or die "mysqlhotcopy failed: $?\n";
 
        # put it to "production dir"
@@ -93,11 +100,6 @@
        if (!-d $cluster_dir && !mkdir($cluster_dir) && !-d $cluster_dir) {
                rmtree($dstdir);
                die "cluster dir '$cluster_dir' not present and can't be 
created\n";
-       }
-
-       my $dirname = "$backup_dir/$cluster/$database";
-       if (-d $dirname) {
-               rmtree($dirname);
        }
 
        my $srcdir = "$dstdir/$database";

================================================================
Index: packages/bacula-backup-mysql/bacula-backup-mysql.spec
diff -u packages/bacula-backup-mysql/bacula-backup-mysql.spec:1.9 
packages/bacula-backup-mysql/bacula-backup-mysql.spec:1.10
--- packages/bacula-backup-mysql/bacula-backup-mysql.spec:1.9   Fri Mar 16 
18:30:43 2012
+++ packages/bacula-backup-mysql/bacula-backup-mysql.spec       Thu Apr  5 
11:36:52 2012
@@ -2,7 +2,7 @@
 %include       /usr/lib/rpm/macros.perl
 Summary:       MySQL backup hook for Bacula
 Name:          bacula-backup-mysql
-Version:       0.4
+Version:       0.5
 Release:       1
 License:       GPL v2
 Group:         Applications/Databases
@@ -54,6 +54,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.10  2012/04/05 09:36:52  glen
+- v0.5: remove target dir before making backup to tmp dir, avoiding double 
disk usage
+
 Revision 1.9  2012/03/16 17:30:43  glen
 - v0.4: allow include_database to contain table regexp like mysqlhotcopy(1)
 
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/packages/bacula-backup-mysql/bacula-backup-mysql?r1=1.15&r2=1.16
    
http://cvs.pld-linux.org/packages/bacula-backup-mysql/bacula-backup-mysql.spec?r1=1.9&r2=1.10

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to