Getting the path to new certificates requested via certonly by a script

I have a script that uses certbot certonly to request certificates, then copy/deploy them. Since the path to the certificates isn’t always /etc/letsencrypt/live/$domain, but can have appended -0001, etc. I’d need to get this path from certbot. I could parse the output of certbot certonly or certbot certificates but I was wondering if there was an easier way, something like an environment variable such as the one that certbot passes with --deploy-hook.

Thanks

1 Like

You can use --cert-name to specify the certificate name - typically the first domain name on the certificate. This will prevent any -001 suffixes and guarantees a predictable path under /etc/letsencrypt/live/.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.