Commit 36fe9c84 authored by Łukasz Nowak's avatar Łukasz Nowak

Use killpidfromfile from software.

Thanks to this instantiation is more self documented.
parent 59e45e66
......@@ -52,17 +52,6 @@ class Recipe(GenericBaseRecipe):
zope_config['z2_log'] = self.options['z2-log']
zope_config['pid-filename'] = self.options['pid-file']
zope_config['lock-filename'] = self.options['lock-file']
# XXX: !!killpidfromfile shall be binary provided by software!!
killpidfromfile = self.createPythonScript('killpidfromfile',
__name__ + '.killpidfromfile')
path_list.append(killpidfromfile)
post_rotate = self.createPythonScript(
self.options['logrotate-post'],
__name__ + '.killpidfromfile',
[zope_config['pid-filename'], 'SIGUSR2']
)
path_list.append(post_rotate)
prefixed_products = []
for product in reversed(zope_config['products'].split()):
product = product.strip()
......
import sys
import os
import signal
def killpidfromfile(*args):
if len(args):
file = args[1]
sig = getattr(signal, args[2], None)
else:
file = sys.argv[1]
sig = getattr(signal, sys.argv[2], None)
if sig is None:
raise ValueError('Unknwon signal name %s' % sig)
if os.path.exists(file):
pid = int(open(file).read())
print 'Killing pid %s with signal %s' % (pid, sig)
os.kill(pid, sig)
......@@ -68,7 +68,7 @@ name = zope
log = $${zope:event-log} $${zope:z2-log}
frequency = daily
rotate-num = 30
post = $${zope:logrotate-post}
post = ${buildout:bin-directory}/killpidfromfile $${zope:pid-file} SIGUSR2
sharedscripts = true
notifempty = true
create = true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment