]> git.pld-linux.org Git - packages/bacula-backup-mysql.git/commitdiff
- v0.5: remove target dir before making backup to tmp dir, avoiding double disk usage auto/ac/bacula-backup-mysql-0_5-1 auto/th/bacula-backup-mysql-0_5-1
authorElan Ruusamäe <glen@pld-linux.org>
Thu, 5 Apr 2012 09:36:52 +0000 (09:36 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    bacula-backup-mysql -> 1.16
    bacula-backup-mysql.spec -> 1.10

bacula-backup-mysql
bacula-backup-mysql.spec

index 247e29c998cb512d437fc239698394fa92e68da7..b44786c1919f8b698be5479ef0e27916278e5261 100644 (file)
@@ -57,13 +57,13 @@ if (!-d $tmpdir && !mkdir($tmpdir) && !-d $tmpdir) {
 
 # 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 @@ sub mysqlhotcopy {
        # 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"
@@ -95,11 +102,6 @@ sub mysqlhotcopy {
                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";
        unless (rename($srcdir, $dirname)) {
                my $err = $!;
index 6848d788b484839681f4730ac20428a697f2224e..003154171e5f10e8c7fb8c7c3104a135d2d3f57b 100644 (file)
@@ -1,7 +1,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
This page took 0.187552 seconds and 4 git commands to generate.