-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0010-Bug-668385-DS-pipe-log-script-is-executed-as-many-ti.patch
106 lines (97 loc) · 3.72 KB
/
0010-Bug-668385-DS-pipe-log-script-is-executed-as-many-ti.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
From b4c869f7c86792afe4bd86395f7336e978a09034 Mon Sep 17 00:00:00 2001
From: Rich Megginson <[email protected]>
Date: Tue, 29 Mar 2011 14:09:02 -0600
Subject: [PATCH 10/11] Bug 668385 - DS pipe log script is executed as many times as the dirsrv service is restarted
https://bugzilla.redhat.com/show_bug.cgi?id=668385
Resolves: bug 668385
Bug Description: DS pipe log script is executed as many times as the dirsrv service is restarted
Reviewed by: nkinder (Thanks!)
Branch: RHEL-6
Fix Description: When running the ds-logpipe "standalone", when not tracking a server
pid, the ds-logpipe script should run forever until explicitly killed.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
(cherry picked from commit bb02e98ee264fe37f4ab6495872a470170277b12)
(cherry picked from commit 51788359843fb9da1b5572c31b25822164462aa4)
---
ldap/admin/src/scripts/ds-logpipe.py | 35 +++++++++++++++++++++++++++------
1 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/ldap/admin/src/scripts/ds-logpipe.py b/ldap/admin/src/scripts/ds-logpipe.py
index 11546d3..04cef6a 100644
--- a/ldap/admin/src/scripts/ds-logpipe.py
+++ b/ldap/admin/src/scripts/ds-logpipe.py
@@ -311,9 +311,19 @@ signal.signal(signal.SIGINT, sighandler)
signal.signal(signal.SIGTERM, sighandler)
signal.signal(signal.SIGALRM, sighandler)
+timerisset = False
+neverdone = False
if options.serverpidfile:
# start the timer to wait for the pid file to be available
signal.setitimer(signal.ITIMER_REAL, options.servertimeout)
+ timerisset = True
+
+# if we are tracking a server, we will be done
+# when the server exits
+# if not tracking a server, we will only be done
+# when we are killed
+if not serverpid and not options.serverpidfile:
+ neverdone = True
done = False
while not done:
@@ -325,9 +335,12 @@ while not done:
if debug:
print "opened pipe", logf
- if options.serverpidfile:
+ if timerisset:
# cancel the timer - the open succeeded
+ timerisset = False
signal.setitimer(signal.ITIMER_REAL, 0)
+ if debug:
+ print "cancelled startup timer"
lines = 0
# read and process the next line in the pipe
@@ -338,13 +351,14 @@ while not done:
lines += 1
# the other end of the pipe closed - we close our end too
+ if debug:
+ print "read", lines, "lines"
logf.close()
logf = None
+ if debug:
+ print "closed log pipe", logfname
- if not serverpid and not options.serverpidfile:
- # no server to deal with - we're done
- done = True;
- elif not serverpid and options.serverpidfile:
+ if not serverpid and options.serverpidfile:
# see if the server has written its server pid file yet
# it may take a "long time" for the server to actually
# write its pid file
@@ -353,8 +367,12 @@ while not done:
# if the server is no longer running, just finish
if serverpid and not is_proc_alive(serverpid):
done = True
-
- if not done:
+ if debug:
+ print "server pid", serverpid, "exited - script exiting"
+
+ if neverdone:
+ done = False
+ elif not done:
if not lines:
# at startup the server will close the log and reopen it
# when it does this lines will be 0 - this means we need
@@ -367,6 +385,9 @@ while not done:
# timeout so we don't wait a long time if the server
# really is exiting
signal.setitimer(signal.ITIMER_REAL, 0.25)
+ timerisset = True
+ if debug:
+ print "set startup timer - see if server is really shut down"
else: # we read something
# pipe closed - usually when server shuts down
done = True
--
1.7.1