/[smeserver]/rpms/e-smith-backup/sme8/e-smith-backup-2.2.0-timeout.patch
ViewVC logotype

Contents of /rpms/e-smith-backup/sme8/e-smith-backup-2.2.0-timeout.patch

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


Revision 1.1 - (show annotations) (download)
Mon Oct 20 16:03:58 2008 UTC (16 years ago) by slords
Branch: MAIN
CVS Tags: e-smith-backup-2_2_0-62_el5_sme, e-smith-backup-2_2_0-30_el5_sme, e-smith-backup-2_2_0-72_el5_sme, e-smith-backup-2_2_0-40_el5_sme, e-smith-backup-2_2_0-27_el5_sme, e-smith-backup-2_2_0-60_el5_sme, e-smith-backup-2_2_0-26_el5_sme, e-smith-backup-2_2_0-25_el5_sme, e-smith-backup-2_2_0-20_el5_sme, e-smith-backup-2_2_0-21_el5_sme, e-smith-backup-2_2_0-66_el5_sme, e-smith-backup-2_2_0-65_el5_sme, e-smith-backup-2_2_0-80_el5_sme, e-smith-backup-2_2_0-44_el5_sme, e-smith-backup-2_2_0-10_el5_sme, e-smith-backup-2_2_0-83_el5_sme, e-smith-backup-2_2_0-41_el5_sme, e-smith-backup-2_2_0-52_el5_sme, e-smith-backup-2_2_0-82_el5_sme, e-smith-backup-2_2_0-38_el5_sme, e-smith-backup-2_2_0-88_el5_sme, e-smith-backup-2_2_0-74_el5_sme, e-smith-backup-2_2_0-55_el5_sme, e-smith-backup-2_2_0-24_el5_sme, e-smith-backup-2_2_0-84_el5_sme, e-smith-backup-2_2_0-63_el5_sme, e-smith-backup-2_2_0-87_el5_sme, e-smith-backup-2_2_0-64_el5_sme, e-smith-backup-2_2_0-15_el5_sme, e-smith-backup-2_2_0-43_el5_sme, e-smith-backup-2_2_0-48_el5_sme, e-smith-backup-2_2_0-12_el5_sme, e-smith-backup-2_2_0-36_el5_sme, e-smith-backup-2_2_0-81_el5_sme, e-smith-backup-2_2_0-68_el5_sme, e-smith-backup-2_2_0-16_el5_sme, e-smith-backup-2_2_0-17_el5_sme, e-smith-backup-2_2_0-35_el5_sme, e-smith-backup-2_2_0-86_el5_sme, e-smith-backup-2_2_0-22_el5_sme, e-smith-backup-2_2_0-34_el5_sme, e-smith-backup-2_2_0-50_el5_sme, e-smith-backup-2_2_0-19_el5_sme, e-smith-backup-2_2_0-51_el5_sme, e-smith-backup-2_2_0-71_el5_sme, e-smith-backup-2_2_0-23_el5_sme, e-smith-backup-2_2_0-61_el5_sme, e-smith-backup-2_2_0-57_el5_sme, e-smith-backup-2_2_0-78_el5_sme, e-smith-backup-2_2_0-73_el5_sme, e-smith-backup-2_2_0-79_el5_sme, e-smith-backup-2_2_0-39_el5_sme, e-smith-backup-2_2_0-33_el5_sme, e-smith-backup-2_2_0-75_el5_sme, e-smith-backup-2_2_0-28_el5_sme, e-smith-backup-2_2_0-76_el5_sme, e-smith-backup-2_2_0-56_el5_sme, e-smith-backup-2_2_0-58_el5_sme, e-smith-backup-2_2_0-9_el5_sme, e-smith-backup-2_2_0-45_el5_sme, e-smith-backup-2_2_0-59_el5_sme, e-smith-backup-2_2_0-32_el5_sme, e-smith-backup-2_2_0-53_el5_sme, e-smith-backup-2_2_0-67_el5_sme, e-smith-backup-2_2_0-42_el5_sme, e-smith-backup-2_2_0-29_el5_sme, e-smith-backup-2_2_0-14_el5_sme, e-smith-backup-2_2_0-70_el5_sme, e-smith-backup-2_2_0-77_el5_sme, e-smith-backup-2_2_0-54_el5_sme, e-smith-backup-2_2_0-85_el5_sme, e-smith-backup-2_2_0-18_el5_sme, e-smith-backup-2_2_0-69_el5_sme, e-smith-backup-2_2_0-37_el5_sme, e-smith-backup-2_2_0-31_el5_sme, e-smith-backup-2_2_0-49_el5_sme, e-smith-backup-2_2_0-13_el5_sme, e-smith-backup-2_2_0-11_el5_sme, e-smith-backup-2_2_0-7_el5_sme, e-smith-backup-2_2_0-47_el5_sme, e-smith-backup-2_2_0-8_el5_sme, e-smith-backup-2_2_0-46_el5_sme, HEAD
Many fixes

1 --- e-smith-backup-2.0.0/root/etc/e-smith/events/actions/workstation-backup-dar.timeout 2008-10-07 11:34:31.000000000 -0600
2 +++ e-smith-backup-2.0.0/root/etc/e-smith/events/actions/workstation-backup-dar 2008-10-20 09:32:14.000000000 -0600
3 @@ -30,6 +30,8 @@
4 use esmith::ConfigDB;
5
6 sub ldie;
7 +sub start_dar_killer;
8 +sub run_backup;
9
10 my $job = shift || 'DailyBackup';
11 my $report;
12 @@ -257,32 +259,7 @@
13
14 # launching dar backup
15
16 -$err = system("/usr/bin/timeout",
17 - "-s",
18 - "TERM",
19 - "$timeout",
20 - "/usr/bin/dar",
21 - "-c",
22 - "$tmpdir/$id/$bkname",
23 - split(/\s+/,$ref),
24 - "-B",
25 - "/etc/dar/$job.dcf");
26 -
27 -if ($err == 0)
28 -{
29 - $report .= "Backup completed successfully on temporary dir \n";
30 -}
31 -elsif ($err == 15)
32 -{
33 - $report .= "Partial backup stored on temp dir.\n"
34 - . " Session closed by timeout after $timeout seconds.\n"
35 - . "Not an error, backup process will continue next night.\n";
36 -}
37 -else
38 -{
39 - $err = $err >> 8;
40 - ldie("Dar error during backup : $err \n");
41 -}
42 +run_backup();
43
44 if ($incnum == 0)
45 {
46 @@ -338,3 +315,63 @@
47 system("/bin/umount", "$mntdir") if $mntdone;
48 die($errmsg);
49 }
50 +
51 +sub start_dar_killer
52 +{
53 + my ($darpid, $gracetime) = @_;
54 + my $tick = $gracetime/10;
55 +
56 + my $killer = fork;
57 + return $killer if $killer;
58 +
59 + POSIX::setsid;
60 + chdir '/';
61 + #fork && exit;
62 +
63 + warn "Dar killer $$ started for PID $darpid with gracetime $gracetime\n";
64 + # wait for timeout or backup termination
65 + while ($tick > 0) {
66 + sleep 10;
67 + $tick--;
68 + exit unless (kill(0, $darpid));
69 + }
70 +
71 + if (kill(0, $darpid)) {
72 + do {
73 + warn "Cleanly stops $darpid dar process\n";
74 + } while (kill('QUIT', $darpid) != 1);
75 + }
76 + warn "Partial backup stored on backup workstation.\n",
77 + "Session cleanly closed by timeout after $timeout seconds.\n",
78 + "Not an error, backup process will continue next night.\n";
79 +
80 + exit;
81 +}
82 +
83 +sub run_backup
84 +{
85 + my $data = undef;
86 + my $pid = undef;
87 + my $killerpid = undef;
88 +
89 + eval {
90 + ($pid = open INPUT, "-|", "/usr/bin/dar", "--create", "$tmpdir/$id/$bkname", split(/\s+/,$ref), "-B", "/etc/dar/$job.dcf") or ldie("cannot start : $!" );
91 + warn "Running dar backup with PID $pid\n";
92 +
93 + if ($pid) {
94 + $killerpid = start_dar_killer($pid, $timeout); }
95 + $data = do { local($/); <INPUT> };
96 + close(INPUT);
97 + };
98 + $report .= $data;
99 +
100 + if ($killerpid && kill(0, $killerpid)) {
101 + do {
102 + warn "Killing killer $killerpid\n";
103 + } while (kill(9, $killerpid) != 1);
104 +
105 + waitpid($killerpid, 0);
106 + }
107 +
108 + return;
109 +}

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