Messages output by hook are treated as errors


When I run a renew hook any message I output show up as Err output from hook-name.
The messages ar in most part info, eg. “A tlsa has be added for …” how can I avoid these message getting treated as errors?


Hi @zzz9998, what do you mean by “show up as error output”? Where do they show up and how are they presented?



It might be also useful to try to describe what you are doing

How you have set things up and what you are expecting



I have written a renew-hook that generates and installs TLSA certificates.
For each TLSA record(s) created it outputs a message(s) using bash printf something like
printf “$(date) new certificate for%s service, port %s…” $serviceName $servicePort $serviceHost 2>&1
when I run this standalone these messages show up on the terminal as expected.
If run certbot with I get the normal certbot output, with an error message

Error output from CertbotTLSAgen:
CertbotTLSAgen - I997 …
CertbotTLSAgen - I997 …
CertbotTLSAgen - I998 ended.
in red
If I switch the printf redirect I don’t get the error, but neither do I get the the messages.


I just look at the Certbot code and seems to be doing the right thing.

Maybe in your script you could try

exec 2>/tmp/oops

near the top and then see what output ends up there. It seems most likely to me that some part of your hook script is, in fact, writing to stderr.


I already do that, in seperate printf to a log file.

However if I do 2>&1 I would expect to see everything on stdout, but I don’t. I seems that certbot is trapping everything. Why is certbot “preventing” output to stdout. If I run certbot as a command I would like to see any progress and/or error messages that my code may be producing.

FYI, I have tried having no redirection, same result no output!


Right, in

all of the stdout output from hooks is captured and discarded. If you have a GitHub account, you could file a bug if you don’t think this is the right behavior. (I’m not positive what I think about this.)


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