From 16e052dc8c56e633ecc6ce651afc82e88c15c495 Mon Sep 17 00:00:00 2001 From: Bruno Zell Date: Fri, 28 Sep 2018 17:14:41 +0200 Subject: [PATCH] comments and documentation --- src/scripts/util.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/scripts/util.sh b/src/scripts/util.sh index 59c89c8..693107d 100644 --- a/src/scripts/util.sh +++ b/src/scripts/util.sh @@ -76,11 +76,15 @@ get_certificate() { --standalone --preferred-challenges http-01 --debug } +# Given a last renewal file with timestamp, return true if a renewal is +# required (last renewal ran over a week ago), return false otherwise is_renewal_required() { + # If the file does not exist assume a renewal is required if [ ! -e "$1" ]; then return true fi + # If the file exists, check if the last renewal was more than a week ago one_week_sec=604800 now_sec=$(date -d now +%s) last_renewal_sec=$(stat -c %Y "$1")