Certbot-auto: RENEWED_LINEAGE is always empty


#1

I’m trying to get the value of the RENEWED_LINEAGE shell variable but it always returns an empty string. Here is the command I use when renewing my certificates:

certbot-auto --force-renew renew --renew-hook "echo $RENEWED_LINEAGE > renewed_lineage"

The renewal succeeds and the file renewed_lineage is created but it’s empty.


#2

I suspect you’re running into a shell-escaping problem.

The way you’ve written the command, your shell, the one you’re at when you run the command, is asked to work out the value of $RENEWED_LINEAGE and substitute it. It has no value for this variable, so the file is blank.

If you write a little shell script, which does this work, and then call that from the command, the shell script will look at its own environment’s $RENEWED_LINEAGE, which will have been set up by the renew hook, so it should work. If you really don’t want to write a shell script, you can also escape the variable so that it is only evaluated later, by writing something like $RENEWED_LINEAGE although exactly how the escaping needs to look may vary depending on your choice of shell.


#3

Thanks! Escaping the variable works!


#4

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