From d6cf5b991b45879a0d1500e81a577a63d4bf1a71 Mon Sep 17 00:00:00 2001 From: Dennis Boldt Date: Sun, 11 Aug 2019 00:39:52 +0200 Subject: [PATCH] Update run.sh On the first run, this script shows the error 'diff: can't stat '/output/cert.pem': No such file or directory', because the file does not exist in the folder `/output` yet. This bugfix ensures, that the diff is only called, when all required files are available. --- optional/traefik-certdumper/run.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/optional/traefik-certdumper/run.sh b/optional/traefik-certdumper/run.sh index eeb45ac0..2880d44f 100755 --- a/optional/traefik-certdumper/run.sh +++ b/optional/traefik-certdumper/run.sh @@ -5,8 +5,10 @@ function dump() { traefik-certs-dumper file --crt-name "cert" --crt-ext ".pem" --key-name "key" --key-ext ".pem" --domain-subdir --dest /tmp/work --source /traefik/acme.json > /dev/null - if diff -q /tmp/work/${DOMAIN}/cert.pem /output/cert.pem >/dev/null && \ - diff -q /tmp/work/${DOMAIN}/key.pem /output/key.pem >/dev/null ; then + if [[ -f /tmp/work/${DOMAIN}/cert.pem && -f /tmp/work/${DOMAIN}/key.pem && -f /output/cert.pem && -f /output/key.pem ]] && \ + diff -q /tmp/work/${DOMAIN}/cert.pem /output/cert.pem >/dev/null && \ + diff -q /tmp/work/${DOMAIN}/key.pem /output/key.pem >/dev/null ; \ + then echo "$(date) Certificate and key still up to date, doing nothing" else echo "$(date) Certificate or key differ, updating"