From 73851752f790dcc26443e263339782a9c29bda5c Mon Sep 17 00:00:00 2001 From: Bruno Zell Date: Fri, 28 Sep 2018 17:11:05 +0200 Subject: [PATCH] renaming --- src/scripts/entrypoint.sh | 10 +++++----- src/scripts/util.sh | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/scripts/entrypoint.sh b/src/scripts/entrypoint.sh index 6d9d712..1235b54 100644 --- a/src/scripts/entrypoint.sh +++ b/src/scripts/entrypoint.sh @@ -23,15 +23,15 @@ for f in /scripts/startup/*.sh; do done echo "Done with startup" -last_sync_file="/etc/letsencrypt/last_sync.txt" +last_renewal_file="/etc/letsencrypt/last_renewal.txt" # Instead of trying to run `cron` or something like that, just sleep and run `certbot`. while [ true ]; do - if [ is_sync_required $last_sync_file ]; then - # recreate the file to persist the last sync timestamp - touch "$last_sync_file" + if [ is_renewal_required $last_renewal_file ]; then + # Recreate the file to persist the last renewal timestamp + touch "$last_renewal_file" - # run certbot to request all the ssl certs we can find + # Run certbot to request all the ssl certs we can find echo "Run certbot" /scripts/run_certbot.sh else diff --git a/src/scripts/util.sh b/src/scripts/util.sh index 9bc775b..59c89c8 100644 --- a/src/scripts/util.sh +++ b/src/scripts/util.sh @@ -76,15 +76,15 @@ get_certificate() { --standalone --preferred-challenges http-01 --debug } -is_sync_required() { +is_renewal_required() { if [ ! -e "$1" ]; then return true fi one_week_sec=604800 - last_sync_sec=$(stat -c %Y "$1") now_sec=$(date -d now +%s) - last_sync_delta_sec=$(( ($now_sec - $last_sync_sec) )) - is_finshed_week_sec=$(( ($one_week_sec - $last_sync_delta_sec) )) + last_renewal_sec=$(stat -c %Y "$1") + last_renewal_delta_sec=$(( ($now_sec - $last_renewal_sec) )) + is_finshed_week_sec=$(( ($one_week_sec - $last_renewal_delta_sec) )) return $is_finshed_week_sec -lt 0 }