From b5f33d2a92929d0118d9bc090de4d93926df84eb Mon Sep 17 00:00:00 2001 From: will Farrell Date: Tue, 20 Jun 2017 08:35:33 -0600 Subject: [PATCH] Add ability to save logs to file use env `LOG=TRUE` --- docker-entrypoint.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 480d713..db579d8 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -2,6 +2,17 @@ set -e #set -x +if [ "${LOG}" == "TRUE" ]; then + LOG_DIR=/var/log/letsencrypt + LOG_FILE=${LOG_DIR}/runtime.log + mkdir -p ${LOG_DIR} + touch ${LOG_FILE} + + UUID=$(cat /proc/sys/kernel/random/uuid) + exec > >(read message; echo "$(date -Iseconds) ${UUID} [info] $message" | tee -a ${LOG_FILE} ) + exec 2> >(read message; echo "$(date -Iseconds) ${UUID} [error] $message" | tee -a ${LOG_FILE} >&2) +fi + if [ "${LE_ENV}" == 'production' ]; then echo "***** ${LE_ENV} *****" sed -i 's@CA=.*@CA="https://acme-v01.api.letsencrypt.org/directory"@g' /etc/dehydrated/config