Skip to content

Test if renewal succeeded without renew-hook #2480

Answered by ldez
smaddock asked this question in Q&A
Discussion options

You must be logged in to vote

I have 2 ideas:

  • generate a temporary script called inside the hook.
  • use the hook to create a temporary file.
temporary generated script
#!/bin/bash

TEMP_HOOK=/tmp/lego-hook.sh

cat > ${TEMP_HOOK}  <<EOF
myFunction() {
  echo "Doing post-renewal things. JJ"
}

myFunction
EOF

chmod u+x /tmp/lego-hook.sh

lego --email="[email protected]" --domains="example.com" --http renew --renew-hook="${TEMP_HOOK}"

rm ${TEMP_HOOK}
temporary file
#!/bin/bash

myFunction() {
  echo "Doing post-renewal things."
}

RENEWED=/tmp/$(tr -dc A-Za-z0-9 </dev/urandom | head -c 13).txt

lego --email="[email protected]" --domains="example.com" --http renew --renew-hook="touch ${RENEWED}"

if test -f "${RENEWED}"; t…

Replies: 1 comment 11 replies

Comment options

You must be logged in to vote
11 replies
@ldez
Comment options

ldez Mar 12, 2025
Maintainer

@smaddock
Comment options

@smaddock
Comment options

@ldez
Comment options

ldez Mar 13, 2025
Maintainer

Answer selected by smaddock
@smaddock
Comment options

@smaddock
Comment options

@ldez
Comment options

ldez Mar 13, 2025
Maintainer

@ldez
Comment options

ldez Mar 13, 2025
Maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants