Commit d04451b0 authored by Antoine Catton's avatar Antoine Catton

Add post_rotate script on stunnel

parent c7fd0874
......@@ -29,6 +29,14 @@ import signal
from slapos.recipe.librecipe import GenericBaseRecipe
def post_rotate(args):
pid_file = args['pid_file']
if os.path.exist(pid_file):
with open(pid_file, 'r') as file_:
pid = file_.read().strip()
os.kill(pid, signal.SIGUSR1)
class Recipe(GenericBaseRecipe):
def install(self):
......@@ -80,4 +88,9 @@ class Recipe(GenericBaseRecipe):
# Reload configuration
os.kill(int(pid, 10), signal.SIGHUP)
if 'post-rotate-script' in self.options:
self.createPythonScript(self.options['post-rotate-script'],
__name__ + 'post_rotate',
dict(pid_file=pid_file))
return path_list
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