diff --git a/certbot/hooks.py b/certbot/hooks.py index 0db4d508d..6aece9bde 100644 --- a/certbot/hooks.py +++ b/certbot/hooks.py @@ -55,10 +55,11 @@ def post_hook(config, renew_final=False): we're called with renew_final=True before actually doing anything. """ + cmd = config.post_hook if config.verb == "renew": if not renew_final: - if config.post_hook: - post_hook.eventually.append(config.post_hook) + if cmd and cmd not in post_hook.eventually: + post_hook.eventually.append(cmd) else: for cmd in post_hook.eventually: logger.info("Running post-hook command: %s", cmd) @@ -66,9 +67,9 @@ def post_hook(config, renew_final=False): if len(post_hook.eventually) == 0: logger.info("No renewals attempted, so not running post-hook") else: # certonly / run - if config.post_hook: - logger.info("Running post-hook command: %s", config.post_hook) - _run_hook(config.post_hook) + if cmd: + logger.info("Running post-hook command: %s", cmd) + _run_hook(cmd) post_hook.eventually = []