Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
2e5b4381
Commit
2e5b4381
authored
Apr 30, 1999
by
Michel Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
activites can be commented out sanely now
parent
397227fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
34 deletions
+64
-34
ZServer/zinit.py
ZServer/zinit.py
+32
-17
lib/python/ZServer/zinit.py
lib/python/ZServer/zinit.py
+32
-17
No files found.
ZServer/zinit.py
View file @
2e5b4381
...
...
@@ -105,7 +105,7 @@ TODO
"""
import
os
,
sys
,
time
import
os
,
sys
,
time
,
signal
SOFTWARE_HOME
=
'/projects/users/zs_zope'
START_FILE
=
os
.
path
.
join
(
SOFTWARE_HOME
,
'ZServer'
,
'start.py'
)
...
...
@@ -125,7 +125,11 @@ class ForkError:
pass
FORK_ATTEMPTS
=
2
BEAT_DELAY
=
1
# This is the number of seconds between the parent pulsing the child.
# Set to 0 to deactivate pulsing.
BEAT_DELAY
=
0
VERBOSE
=
1
# If you want the parent to 'pulse' Zope every 'BEAT_DELAY' seconds,
...
...
@@ -137,8 +141,8 @@ VERBOSE = 1
# username and password may be None if the method does not require
# authentication.
activities
=
((
'http://localhost:9222/Heart/heart'
,
'michel'
,
'123'
),
)
#
activities = (('http://localhost:9222/Heart/heart', 'michel', '123'),
#
)
def
pstamp
(
message
):
...
...
@@ -146,15 +150,16 @@ def pstamp(message):
def
heartbeat
():
print
'tha-thump'
for
a
in
activities
:
try
:
result
=
ZPublisher
.
Client
.
call
(
a
[
0
],
a
[
1
],
a
[
2
])
except
:
pstamp
(
'activity %s failed!'
%
a
[
0
])
return
if
activities
:
for
a
in
activities
:
try
:
result
=
ZPublisher
.
Client
.
call
(
a
[
0
],
a
[
1
],
a
[
2
])
except
:
pstamp
(
'activity %s failed!'
%
a
[
0
])
return
if
result
and
VERBOSE
:
pstamp
(
'activity %s returned: %s'
%
(
a
[
0
],
result
))
if
result
and
VERBOSE
:
pstamp
(
'activity %s returned: %s'
%
(
a
[
0
],
result
))
def
forkit
(
attempts
=
FORK_ATTEMPTS
):
...
...
@@ -187,11 +192,14 @@ def main():
pf
.
write
((
"%s"
%
os
.
getpid
()))
pf
.
close
()
while
1
:
p
,
s
=
os
.
waitpid
(
pid
,
os
.
WNOHANG
)
if
not
p
:
time
.
sleep
(
BEAT_DELAY
)
heartbeat
()
continue
if
not
BEAT_DELAY
:
p
,
s
=
os
.
waitpid
(
pid
,
0
)
else
:
p
,
s
=
os
.
waitpid
(
pid
,
os
.
WNOHANG
)
if
not
p
:
time
.
sleep
(
BEAT_DELAY
)
heartbeat
()
continue
if
s
:
pstamp
((
'Aiieee! %s exited with error code: %s'
%
(
p
,
s
)))
...
...
@@ -218,3 +226,10 @@ def main():
if
__name__
==
'__main__'
:
main
()
lib/python/ZServer/zinit.py
View file @
2e5b4381
...
...
@@ -105,7 +105,7 @@ TODO
"""
import
os
,
sys
,
time
import
os
,
sys
,
time
,
signal
SOFTWARE_HOME
=
'/projects/users/zs_zope'
START_FILE
=
os
.
path
.
join
(
SOFTWARE_HOME
,
'ZServer'
,
'start.py'
)
...
...
@@ -125,7 +125,11 @@ class ForkError:
pass
FORK_ATTEMPTS
=
2
BEAT_DELAY
=
1
# This is the number of seconds between the parent pulsing the child.
# Set to 0 to deactivate pulsing.
BEAT_DELAY
=
0
VERBOSE
=
1
# If you want the parent to 'pulse' Zope every 'BEAT_DELAY' seconds,
...
...
@@ -137,8 +141,8 @@ VERBOSE = 1
# username and password may be None if the method does not require
# authentication.
activities
=
((
'http://localhost:9222/Heart/heart'
,
'michel'
,
'123'
),
)
#
activities = (('http://localhost:9222/Heart/heart', 'michel', '123'),
#
)
def
pstamp
(
message
):
...
...
@@ -146,15 +150,16 @@ def pstamp(message):
def
heartbeat
():
print
'tha-thump'
for
a
in
activities
:
try
:
result
=
ZPublisher
.
Client
.
call
(
a
[
0
],
a
[
1
],
a
[
2
])
except
:
pstamp
(
'activity %s failed!'
%
a
[
0
])
return
if
activities
:
for
a
in
activities
:
try
:
result
=
ZPublisher
.
Client
.
call
(
a
[
0
],
a
[
1
],
a
[
2
])
except
:
pstamp
(
'activity %s failed!'
%
a
[
0
])
return
if
result
and
VERBOSE
:
pstamp
(
'activity %s returned: %s'
%
(
a
[
0
],
result
))
if
result
and
VERBOSE
:
pstamp
(
'activity %s returned: %s'
%
(
a
[
0
],
result
))
def
forkit
(
attempts
=
FORK_ATTEMPTS
):
...
...
@@ -187,11 +192,14 @@ def main():
pf
.
write
((
"%s"
%
os
.
getpid
()))
pf
.
close
()
while
1
:
p
,
s
=
os
.
waitpid
(
pid
,
os
.
WNOHANG
)
if
not
p
:
time
.
sleep
(
BEAT_DELAY
)
heartbeat
()
continue
if
not
BEAT_DELAY
:
p
,
s
=
os
.
waitpid
(
pid
,
0
)
else
:
p
,
s
=
os
.
waitpid
(
pid
,
os
.
WNOHANG
)
if
not
p
:
time
.
sleep
(
BEAT_DELAY
)
heartbeat
()
continue
if
s
:
pstamp
((
'Aiieee! %s exited with error code: %s'
%
(
p
,
s
)))
...
...
@@ -218,3 +226,10 @@ def main():
if
__name__
==
'__main__'
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment