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

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

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


Revision 1.1 - (hide annotations) (download)
Mon Jul 15 00:04:27 2013 UTC (11 years, 3 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-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-13.sme
- Workstation Backup, add a choice to delete old backup before or after backup [SME: 7766]

1 wellsi 1.1 diff -ruN e-smith-backup-2.2.0.old/root/etc/e-smith/events/actions/workstation-backup-dar e-smith-backup-2.2.0/root/etc/e-smith/events/actions/workstation-backup-dar
2     --- e-smith-backup-2.2.0.old/root/etc/e-smith/events/actions/workstation-backup-dar 2013-07-06 19:50:52.000000000 -0700
3     +++ e-smith-backup-2.2.0/root/etc/e-smith/events/actions/workstation-backup-dar 2013-07-06 20:10:43.000000000 -0700
4     @@ -83,6 +83,7 @@
5     my $mntdir = ($VFSType eq 'usb') ? "\/$smbshare" : $backupwk->prop('Mount') || '/mnt/smb';
6     my $frommail = $backupwk->prop('FromMail') || 'admin-backup';
7     my $tomail = $backupwk->prop('ToMail') || 'admin';
8     +my $deleteearly = $backupwk->prop('DeleteEarly') || 'false';
9     my $ether = $internalinterface->prop('Name');
10     my $tmpdir;
11    
12     @@ -127,14 +127,6 @@
13     Verify availability of your backup volume. Stopping the backup now.\n");
14     }
15    
16     -$tmpdir = $mntdir . '/tmp_dir';
17     -
18     -&removeTree ("$tmpdir/$id");
19     -&createTree ("$tmpdir/$id");
20     -
21     -# we know right backup directory is in line and we can write on it.
22     -$report .= "Backup temp directory $tmpdir/$id is mounted and is writable \n";
23     -
24     # rotating backup indicators
25    
26     ++$incnum;
27     @@ -160,6 +152,19 @@
28     my $setname = "set" . $setnum;
29     my $setdirname = $mntdir . "/$id/" . $setname;
30     &createTree ($setdirname);
31     +
32     +if ($deleteearly ne 'true')
33     +{
34     + $tmpdir = $mntdir . '/tmp_dir';
35     +
36     + &removeTree ("$tmpdir/$id");
37     + &createTree ("$tmpdir/$id");
38     + $report .= "Backup temp directory $tmpdir/$id is mounted and is writable \n";
39     +}
40     +else
41     +{
42     + $report .= "Backup directory $setdirname is mounted \n";
43     +}
44    
45     if ( $incnum == 0 )
46     {
47     @@ -203,7 +209,6 @@
48     }
49    
50     $report .= "Backup to $bkname in $id/$setname\n";
51     -$report .= "Making backup in temp directory\n";
52    
53     # calculate real timeout if we timeout incrementals only.
54     # timeout of 88500 is a security for aborting backup within 24h
55     @@ -212,7 +213,7 @@
56     {
57     $timeout = 88500;
58     }
59     -$report .= "Using a backup session timeout of : $timeout seconds\n";
60     +$report .= "Starting the backup with a timeout of $timeout seconds\n";
61    
62     # expanding backup configuration file template
63    
64     @@ -221,30 +226,37 @@
65     });
66    
67     # launching dar backup
68     -
69     -my $rc = run_backup();
70     -if ($rc != 0 && $rc != 11)
71     +if (($deleteearly eq 'true') && (($incnum == 0))) # Allow delete before backup
72     {
73     - ldie("Error while running dar: $rc");
74     -}
75     -
76     -if ($incnum == 0)
77     -{
78     - $report .= "Rotating backups in a new set $setdirname. \n";
79     &removeTree ($setdirname);
80     &createTree ($setdirname);
81     }
82    
83     -$report .= "Moving backup files to target directory $setdirname \n";
84     +my $destination = ($deleteearly ne 'true') ? "$tmpdir/$id/$bkname" : "$setdirname/$bkname";
85    
86     -foreach (bsd_glob("$tmpdir/$id/$bkname*"))
87     -{
88     - ldie("Error while moving backup file $_ from temporary dir $tmpdir/$id to $setdirname : $!")
89     - unless move($_, $setdirname);
90     +# Perform the actual backup
91     +my $rc = run_backup($destination);
92     +
93     +if ($rc != 0 && $rc != 11)
94     +{
95     + ldie("Error while running dar: $rc");
96     }
97    
98     -# Remove temporary directory as no longer needed
99     -&removeTree ("$tmpdir/$id");
100     +if ($deleteearly ne 'true') # Not DeleteEarly so move backup to $setdirname
101     +{
102     + $report .= "Moving backup files to target directory $setdirname \n";
103     + if ($incnum == 0)
104     + {
105     + &removeTree ($setdirname);
106     + &createTree ($setdirname);
107     + }
108     + foreach (bsd_glob("$tmpdir/$id/$bkname*"))
109     + {
110     + ldie("Error while moving backup file $_ from temporary dir $tmpdir/$id to $setdirname : $!")
111     + unless move($_, $setdirname);
112     + }
113     + &removeTree ("$tmpdir/$id");
114     +}
115    
116     # update dar_manager catalog
117     $report .= "Updating catalog\n";
118     @@ -425,12 +431,13 @@
119    
120     sub run_backup
121     {
122     + my $dest = shift;
123     my $data = undef;
124     my $pid = undef;
125     my $killerpid = undef;
126    
127     eval {
128     - ($pid = open INPUT, "-|", "/usr/bin/dar", "-Q", "--create", "$tmpdir/$id/$bkname", split(/\|/,$ref), "-B", "/etc/dar/$job.dcf") or ldie("cannot start : $!" );
129     + ($pid = open INPUT, "-|", "/usr/bin/dar", "-Q", "--create", "$dest", split(/\|/,$ref), "-B", "/etc/dar/$job.dcf") or ldie("cannot start : $!" );
130    
131     if ($pid) {
132     $killerpid = start_dar_killer($pid, $timeout); }

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