/[smeserver]/rpms/e-smith-backup/sme9/e-smith-backup-2.4.0-workstation-removeTemp.patch
ViewVC logotype

Annotation of /rpms/e-smith-backup/sme9/e-smith-backup-2.4.0-workstation-removeTemp.patch

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


Revision 1.1 - (hide annotations) (download)
Sun Jul 14 22:50:03 2013 UTC (10 years, 11 months ago) by wellsi
Branch: MAIN
CVS Tags: e-smith-backup-2_4_0-25_el6_sme, e-smith-backup-2_4_0-46_el6_sme, e-smith-backup-2_4_0-23_el6_sme, e-smith-backup-2_4_0-28_el6_sme, e-smith-backup-2_4_0-35_el6_sme, e-smith-backup-2_4_0-21_el6_sme, e-smith-backup-2_4_0-44_el6_sme, e-smith-backup-2_4_0-37_el6_sme, e-smith-backup-2_4_0-24_el6_sme, e-smith-backup-2_4_0-45_el6_sme, e-smith-backup-2_4_0-31_el6_sme, e-smith-backup-2_4_0-30_el6_sme, e-smith-backup-2_4_0-16_el6_sme, e-smith-backup-2_4_0-39_el6_sme, e-smith-backup-2_4_0-40_el6_sme, e-smith-backup-2_4_0-43_el6_sme, e-smith-backup-2_4_0-32_el6_sme, e-smith-backup-2_4_0-42_el6_sme, e-smith-backup-2_4_0-19_el6_sme, e-smith-backup-2_4_0-34_el6_sme, e-smith-backup-2_4_0-22_el6_sme, e-smith-backup-2_4_0-36_el6_sme, e-smith-backup-2_4_0-20_el6_sme, e-smith-backup-2_4_0-12_el6_sme, e-smith-backup-2_4_0-17_el6_sme, e-smith-backup-2_4_0-14_el6_sme, e-smith-backup-2_4_0-33_el6_sme, e-smith-backup-2_4_0-26_el6_sme, e-smith-backup-2_4_0-38_el6_sme, e-smith-backup-2_4_0-29_el6_sme, e-smith-backup-2_4_0-13_el6_sme, e-smith-backup-2_4_0-27_el6_sme, e-smith-backup-2_4_0-18_el6_sme, e-smith-backup-2_4_0-41_el6_sme, e-smith-backup-2_4_0-15_el6_sme, HEAD
* Sun Jul 14 2013 Ian Wells <esmith@wellsi.com> 2.4.0-12.sme
- Workstation Backup, remove temporary directoy on success [SME: 7765]
- Refactor directory tree creation and removal.

1 wellsi 1.1 diff -ruN e-smith-backup-2.4.0.old/root/etc/e-smith/events/actions/workstation-backup-dar e-smith-backup-2.4.0/root/etc/e-smith/events/actions/workstation-backup-dar
2     --- e-smith-backup-2.4.0.old/root/etc/e-smith/events/actions/workstation-backup-dar 2013-07-14 15:16:30.000000000 -0700
3     +++ e-smith-backup-2.4.0/root/etc/e-smith/events/actions/workstation-backup-dar 2013-07-14 15:14:05.000000000 -0700
4     @@ -26,7 +26,7 @@
5     use esmith::templates;
6     use Time::localtime;
7     use File::Copy;
8     -use File::Path qw(make_path remove_tree mkpath rmtree);
9     +use File::Path qw(make_path remove_tree);
10     use File::Find;
11     use POSIX ":sys_wait_h";
12     use File::Glob qw(bsd_glob);
13     @@ -114,7 +114,7 @@
14     }
15    
16     # create the directory mount point if it does not exist
17     -make_path ($mntdir) unless (-d $mntdir);
18     +createTree ($mntdir);
19    
20     # mount the backup directory
21     $err = &dmount($smbhost,$smbshare,$mntdir,$login,$password,$VFSType);
22     @@ -128,14 +128,9 @@
23     }
24    
25     $tmpdir = $mntdir . '/tmp_dir';
26     -if (-d "$tmpdir/$id")
27     -{
28     - eval {rmtree("$tmpdir/$id")};
29     - ldie("Error while deleting $tmpdir/$id : $@.\n") if $@;
30     -}
31     -eval {mkpath("$tmpdir/$id")};
32     -ldie("Error while creating $tmpdir/$id : $@. Maybe insufficient rights on backup directory.\n")
33     - if $@;
34     +
35     +&removeTree ("$tmpdir/$id");
36     +&createTree ("$tmpdir/$id");
37    
38     # we know right backup directory is in line and we can write on it.
39     $report .= "Backup temp directory $tmpdir/$id is mounted and is writable \n";
40     @@ -164,13 +159,7 @@
41     # if no set directory, make it
42     my $setname = "set" . $setnum;
43     my $setdirname = $mntdir . "/$id/" . $setname;
44     -
45     -unless ( -d $setdirname )
46     -{
47     - eval {mkpath($setdirname)};
48     - ldie("Can't create $setdirname : $@.\n") if $@;
49     - $report .= "Backup directory $id/$setname created \n";
50     -}
51     +&createTree ($setdirname);
52    
53     if ( $incnum == 0 )
54     {
55     @@ -213,7 +202,7 @@
56     ldie("Not a permitted day for full backup. Aborting...\nNext full backup in $delay days.\n");
57     }
58    
59     -$report .= "Backup base file name is $bkname \n";
60     +$report .= "Backup to $bkname in $id/$setname\n";
61     $report .= "Making backup in temp directory\n";
62    
63     # calculate real timeout if we timeout incrementals only.
64     @@ -242,10 +231,8 @@
65     if ($incnum == 0)
66     {
67     $report .= "Rotating backups in a new set $setdirname. \n";
68     - eval {rmtree($setdirname)};
69     - ldie("Error while deleting $setdirname : $@.\n") if $@;
70     - eval {mkpath("$setdirname")};
71     - ldie("Error while creating $setdirname : $@.\n") if $@;
72     + &removeTree ($setdirname);
73     + &createTree ($setdirname);
74     }
75    
76     $report .= "Moving backup files to target directory $setdirname \n";
77     @@ -256,8 +243,10 @@
78     unless move($_, $setdirname);
79     }
80    
81     -# update dar_manager catalog
82     +# Remove temporary directory as no longer needed
83     +&removeTree ("$tmpdir/$id");
84    
85     +# update dar_manager catalog
86     $report .= "Updating catalog\n";
87    
88     my %backupfiles = ();
89     @@ -523,3 +512,24 @@
90     return ("Mount of type $VFSType not supported.\n");
91     }
92     }
93     +
94     +
95     +sub removeTree
96     +{
97     + my $tree = shift;
98     + if (-d "$tree")
99     + {
100     + eval {remove_tree("$tree")};
101     + ldie("Error while deleting $tree : $@.\n") if $@;
102     + }
103     +}
104     +
105     +sub createTree
106     +{
107     + my $tree = shift;
108     + if (! -d "$tree")
109     + {
110     + eval {make_path("$tree")};
111     + ldie("Error while creating $tree : $@. Maybe insufficient rights directory.\n") if $@;
112     + }
113     +}

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