Commit aeb12f1d authored by Łukasz Nowak's avatar Łukasz Nowak

- register zeo rotation and add utility script to send any signal to pid value stored in file


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45648 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4ad6c16f
...@@ -55,6 +55,10 @@ class Recipe(BaseSlapRecipe): ...@@ -55,6 +55,10 @@ class Recipe(BaseSlapRecipe):
# self.cron_d is a directory, where cron jobs can be registered # self.cron_d is a directory, where cron jobs can be registered
self.cron_d = self.installCrond() self.cron_d = self.installCrond()
self.logrotate_d = self.installLogrotate() self.logrotate_d = self.installLogrotate()
self.killpidfromfile = zc.buildout.easy_install.scripts(
[('killpidfromfile', __name__ + '.killpidfromfile',
'killpidfromfile')], self.ws, sys.executable, self.bin_directory)[0]
self.path_list.append(self.killpidfromfile)
ca_conf = self.installCertificateAuthority() ca_conf = self.installCertificateAuthority()
memcached_conf = self.installMemcached(ip=self.getLocalIPv4Address(), memcached_conf = self.installMemcached(ip=self.getLocalIPv4Address(),
port=11000) port=11000)
...@@ -460,12 +464,16 @@ class Recipe(BaseSlapRecipe): ...@@ -460,12 +464,16 @@ class Recipe(BaseSlapRecipe):
return [] return []
def installZeo(self, ip, port, name, path): def installZeo(self, ip, port, name, path):
zeo_event_log = os.path.join(self.log_directory, 'zeo.log')
zeo_pid = os.path.join(self.run_directory, 'zeo.pid')
self.registerLogRotation('zeo', [zeo_event_log],
self.killpidfromfile + ' ' + zeo_pid + ' SIGUSR2')
config = dict( config = dict(
zeo_ip=ip, zeo_ip=ip,
zeo_port=port, zeo_port=port,
zeo_storagename=name, zeo_storagename=name,
zeo_event_log=os.path.join(self.log_directory, 'zeo.log'), zeo_event_log=zeo_event_log,
zeo_pid=os.path.join(self.run_directory, 'zeo.pid'), zeo_pid=zeo_pid,
zeo_zodb=path zeo_zodb=path
) )
zeo_conf_path = self.createConfigurationFile('zeo.conf', zeo_conf_path = self.createConfigurationFile('zeo.conf',
......
import sys
import os
import signal
def killpidfromfile():
file = sys.argv[1]
sig = getattr(signal, sys.argv[2], None)
if sig is None:
raise ValueError('Unknwon signal name %s' % sys.argv[2])
if os.path.exists(file):
pid = int(open(file).read())
print 'Killing pid %s with signal %s' % (pid, sys.argv[2])
os.kill(pid, sig)
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