update datetime

This commit is contained in:
Valder Gallo 2018-06-27 20:13:11 -03:00
parent 43a2b720f6
commit 91af6eaabc
2 changed files with 14 additions and 3 deletions

View File

@ -26,6 +26,17 @@ for f in /scripts/startup/*.sh; do
done
echo "Done with startup"
now=$(date)
last_sync_file="/etc/letsencrypt/last_sync.txt"
if [[ ! -e "$last_sync_file" ]]; then
mkdir -p /Scripts
touch "$last_sync_file"
fi
last_sync=$(stat -c %y "$last_sync_file")
updated_days=$(( ($(date -d now +%s) - $(date -d last_sync +%s) )/(60*60*24) ))
# Instead of trying to run `cron` or something like that, just leep and run `certbot`.
while [ true ]; do
# Sleep for 1 week

View File

@ -63,14 +63,14 @@ get_certificate() {
STAGING_URL='https://acme-staging.api.letsencrypt.org/directory'
if [[ ! "${IS_STAGING}" = "1" ]]; then
LETSENCRYPT_URL=STAGING_URL
letsencrypt_url=STAGING_URL
echo "Staging on"
else
LETSENCRYPT_URL=PRODUCTION_URL
letsencrypt_url=PRODUCTION_URL
echo "Production on"
fi
certbot certonly --agree-tos --keep -n --text --email $2 --server \
$LETSENCRYPT_URL -d $1 --http-01-port 1337 \
$letsencrypt_url -d $1 --http-01-port 1337 \
--standalone --standalone-supported-challenges http-01 --debug
}