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 2011-03-11 16:19:35.000000000 +0000 |
3 |
+++ e-smith-backup-2.2.0/root/etc/e-smith/events/actions/workstation-backup-dar 2011-03-11 16:20:10.000000000 +0000 |
4 |
@@ -27,6 +27,7 @@ |
5 |
use Time::localtime; |
6 |
use File::Copy; |
7 |
use File::Path; |
8 |
+use POSIX ":sys_wait_h"; |
9 |
use esmith::ConfigDB; |
10 |
|
11 |
sub ldie; |
12 |
@@ -292,7 +293,11 @@ |
13 |
|
14 |
# launching dar backup |
15 |
|
16 |
-run_backup(); |
17 |
+my $rc = run_backup(); |
18 |
+if ($rc != 0) |
19 |
+{ |
20 |
+ ldie("Error while running dar: $rc"); |
21 |
+} |
22 |
|
23 |
if ($incnum == 0) |
24 |
{ |
25 |
@@ -379,7 +384,7 @@ |
26 |
$tick--; |
27 |
exit unless (kill(0, $darpid)); |
28 |
} |
29 |
- |
30 |
+ |
31 |
if (kill(0, $darpid)) { |
32 |
while (kill('QUIT', $darpid) != 1) { |
33 |
warn "Failed to stop $darpid dar process\n"; |
34 |
@@ -404,10 +409,9 @@ |
35 |
if ($pid) { |
36 |
$killerpid = start_dar_killer($pid, $timeout); } |
37 |
$data = do { local($/); <INPUT> }; |
38 |
- close(INPUT); |
39 |
}; |
40 |
$report .= $data; |
41 |
- |
42 |
+ |
43 |
if ($killerpid && kill(0, $killerpid)) { |
44 |
while (kill(9, $killerpid) != 1) { |
45 |
warn "Failed to kill $killerpid killer process\n"; |
46 |
@@ -416,5 +420,8 @@ |
47 |
waitpid($killerpid, 0); |
48 |
} |
49 |
|
50 |
- return; |
51 |
+ waitpid($pid, 0); |
52 |
+ my $code = WEXITSTATUS($?); |
53 |
+ close(INPUT); |
54 |
+ return $code; |
55 |
} |