1 |
mweinber |
1.1 |
--- smeserver-affa-1.0.0/root/sbin/e-smith/affa.bug4210 2008-04-04 15:15:07.000000000 +0200 |
2 |
|
|
+++ smeserver-affa-1.0.0/root/sbin/e-smith/affa 2008-04-22 09:03:02.000000000 +0200 |
3 |
|
|
@@ -38,7 +38,7 @@ |
4 |
|
|
|
5 |
|
|
$ENV{LANG} = "en_US"; # Filesys::DiskFree only works with english LANG setting |
6 |
|
|
|
7 |
|
|
-my $VERSION='0.10.0-1'; |
8 |
|
|
+my $VERSION='1.0.0-1'; |
9 |
|
|
|
10 |
|
|
|
11 |
|
|
# sub prototypes |
12 |
|
|
@@ -540,6 +540,11 @@ |
13 |
|
|
|
14 |
|
|
shiftArchives(); |
15 |
|
|
putDoneDates( $jobname ); |
16 |
|
|
+updateReportDB(); |
17 |
|
|
+execPostJobCommand(0); |
18 |
|
|
+emptyTrash(); |
19 |
|
|
+DiskSpaceWarn(); |
20 |
|
|
+sendSuccessMesssage(); |
21 |
|
|
affaExit( "Completed job $jobname $Command ($job{'remoteHostName'})" ); |
22 |
|
|
|
23 |
|
|
exit 0; ############################################################################ |
24 |
|
|
@@ -650,7 +655,7 @@ |
25 |
|
|
} |
26 |
|
|
else |
27 |
|
|
{ |
28 |
|
|
- lg('Warning: DNS resolver timeout'); |
29 |
|
|
+ dbg("Warning: DNS resolver timeout for $job{'remoteHostName'} ($jobname)"); |
30 |
|
|
} |
31 |
|
|
} |
32 |
|
|
# check for remoteHostName==localhost using e-smith DB |
33 |
|
|
@@ -1019,7 +1024,7 @@ |
34 |
|
|
my $res=''; |
35 |
|
|
while( defined ($ar=readdir(DIR)) ) |
36 |
|
|
{ |
37 |
|
|
- next if not $ar =~ /^(scheduled|hourly|daily|weekly|monthly|yearly])\.[0-9]+$/; |
38 |
|
|
+ next if not $ar =~ /^(scheduled|daily|weekly|monthly|yearly])\.[0-9]+$/; |
39 |
|
|
if( -f "$job{'RootDir'}/$jobname/$ar/.AFFA-REPORT" ) |
40 |
|
|
{ |
41 |
|
|
open( AS, "<$job{'RootDir'}/$jobname/$ar/.AFFA-REPORT" ); |
42 |
|
|
@@ -1150,7 +1155,7 @@ |
43 |
|
|
my $archive; |
44 |
|
|
while( defined ($archive=readdir(DIR)) ) |
45 |
|
|
{ |
46 |
|
|
- next if not $archive =~ /^(scheduled|hourly|daily|weekly|monthly|yearly])\.[0-9]+$/; |
47 |
|
|
+ next if not $archive =~ /^(scheduled|daily|weekly|monthly|yearly])\.[0-9]+$/; |
48 |
|
|
my $report = $affareport->new_record($archive); |
49 |
|
|
$report->set_prop('type','affabackup'); |
50 |
|
|
$report->set_prop('RootDir',"$job{'RootDir'}/$jobname/$archive/"); |
51 |
|
|
@@ -1191,7 +1196,7 @@ |
52 |
|
|
|
53 |
|
|
sub execPreJobCommand() |
54 |
|
|
{ |
55 |
|
|
- return if not $job{'preJobCommand'}; |
56 |
|
|
+ return if not $jobname or $Command ne "scheduled" or not $job{'preJobCommand'}; |
57 |
|
|
lg( "Executing preJobCommand $job{'preJobCommand'}"); |
58 |
|
|
affaErrorExit( "Couldn't execute preJobCommand $job{'preJobCommand'}") if not -x $job{'preJobCommand'}; |
59 |
|
|
my @cmd = ( $job{'preJobCommand'}, $job{'remoteHostName'}, $jobname, $Command ); |
60 |
|
|
@@ -1200,7 +1205,7 @@ |
61 |
|
|
|
62 |
|
|
sub execPostJobCommand($) |
63 |
|
|
{ |
64 |
|
|
- return if not $job{'postJobCommand'}; |
65 |
|
|
+ return if not $jobname or $Command ne "scheduled" or not $job{'postJobCommand'}; |
66 |
|
|
lg( "Executing postJobCommand $job{'postJobCommand'}"); |
67 |
|
|
affaErrorExit( "Couldn't execute postJobCommand $job{'postJobCommand'}") if not -x $job{'postJobCommand'}; |
68 |
|
|
my @cmd = ( $job{'postJobCommand'}, $job{'remoteHostName'}, $jobname, $Command, shift(@_) ); |
69 |
|
|
@@ -1628,7 +1633,7 @@ |
70 |
|
|
my %va; |
71 |
|
|
while( defined ($ar=readdir(DIR)) ) |
72 |
|
|
{ |
73 |
|
|
- next if not $ar =~ /^(scheduled|hourly|daily|weekly|monthly|yearly])\.[0-9]+$/; |
74 |
|
|
+ next if not $ar =~ /^(scheduled|daily|weekly|monthly|yearly])\.[0-9]+$/; |
75 |
|
|
if( -f "$rootDir/$jobname/$ar/.AFFA-REPORT" ) |
76 |
|
|
{ |
77 |
|
|
open( AS, "<$rootDir/$jobname/$ar/.AFFA-REPORT" ); |
78 |
|
|
@@ -1666,7 +1671,7 @@ |
79 |
|
|
my $af; |
80 |
|
|
while( defined ($af=readdir(DIR)) ) |
81 |
|
|
{ |
82 |
|
|
- next if not $af =~ /^(scheduled|hourly|daily|weekly|monthly|yearly])\.[0-9]+$/; |
83 |
|
|
+ next if not $af =~ /^(scheduled|daily|weekly|monthly|yearly])\.[0-9]+$/; |
84 |
|
|
(my $k, my $b)=split(/\./, $af); |
85 |
|
|
next if( $b<$job{$k."Keep"} ); |
86 |
|
|
$k =~ s/scheduled/A/; $k =~ s/daily/B/; $k =~ s/weekly/C/; $k =~ s/monthly/D/; $k =~ s/yearly/E/; |
87 |
|
|
@@ -2981,12 +2986,7 @@ |
88 |
|
|
sub affaExit( $ ) |
89 |
|
|
{ |
90 |
|
|
my $msg = shift(@_); |
91 |
|
|
- updateReportDB(); |
92 |
|
|
- emptyTrash(); |
93 |
|
|
- execPostJobCommand(0); |
94 |
|
|
- DiskSpaceWarn(); |
95 |
|
|
unmountAll(); |
96 |
|
|
- sendSuccessMesssage(); |
97 |
|
|
lg( $msg ); |
98 |
|
|
removeLock(); |
99 |
|
|
lg( "Exiting." ); |