renaming
This commit is contained in:
parent
96897f8e37
commit
73851752f7
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue