From fa8e8fc3e30d7aaddb13dfa5bb8501c7c42adcd5 Mon Sep 17 00:00:00 2001 From: jtbr Date: Sun, 19 Mar 2017 19:25:17 +0100 Subject: [PATCH] Explains how these commands are useful for --cron --- ...ook',-'--renew-hook'-and-'--reload-cmd'.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Using-'--pre-hook',-'--post-hook',-'--renew-hook'-and-'--reload-cmd'.md b/Using-'--pre-hook',-'--post-hook',-'--renew-hook'-and-'--reload-cmd'.md index ce89be8..a516a15 100644 --- a/Using-'--pre-hook',-'--post-hook',-'--renew-hook'-and-'--reload-cmd'.md +++ b/Using-'--pre-hook',-'--post-hook',-'--renew-hook'-and-'--reload-cmd'.md @@ -1,8 +1,17 @@ -Those hooks are only working with `--issue` or `--install-cert` command. +Those hooks are only accepted by the `--issue` command, but will be saved and apply to `--renew` or `--cron` commands as well. As such it can be a good way to do things (like close and re-open a server, or notify of updates) that need to happen only when issuance is actually attempted. ```sh -acme.sh --install-cert -d example.com \ - --pre-hook "echo this is pre hook" \ - --post-hook "echo this is post hook." \ - --renew-hook "echo this will be called when success renewed." ....... +acme.sh --issue -d example.com \ + --pre-hook "echo this is pre hook that happens before attempting to issue a certificate." \ + --post-hook "echo this is post hook that happens after attempting to issue a certificate." \ + --renew-hook "echo this will be called when certs are successfully renewed." ....... ``` + +Note: to reload the web server when installing certificates, there is a related command: +```sh +acme.sh --install-cert \ + ..... \ + --reloadcmd "echo this runs after successfully installing certificates." +``` + +Keep in mind that when running `--cron`, any newly-renewed certificates will automatically be installed, and the reloadcmd will be run. Consequently, if you are using `--pre-hook` and `--post-hook` to stop and restart a web server, you probably don't want to also reload it in reloadcmd. Since `--install-cert` is typically only run once, you can just do this by hand. \ No newline at end of file