diff --git a/slapos/recipe/stunnel/__init__.py b/slapos/recipe/stunnel/__init__.py index c418602660df07e4011fd141e8acb1a3c4916599..3ad00b584ab9741cb1a8f85a46440698cb822d22 100644 --- a/slapos/recipe/stunnel/__init__.py +++ b/slapos/recipe/stunnel/__init__.py @@ -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