update datetime
This commit is contained in:
parent
43a2b720f6
commit
91af6eaabc
|
@ -26,6 +26,17 @@ for f in /scripts/startup/*.sh; do
|
||||||
done
|
done
|
||||||
echo "Done with startup"
|
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`.
|
# Instead of trying to run `cron` or something like that, just leep and run `certbot`.
|
||||||
while [ true ]; do
|
while [ true ]; do
|
||||||
# Sleep for 1 week
|
# Sleep for 1 week
|
||||||
|
|
|
@ -63,14 +63,14 @@ get_certificate() {
|
||||||
STAGING_URL='https://acme-staging.api.letsencrypt.org/directory'
|
STAGING_URL='https://acme-staging.api.letsencrypt.org/directory'
|
||||||
|
|
||||||
if [[ ! "${IS_STAGING}" = "1" ]]; then
|
if [[ ! "${IS_STAGING}" = "1" ]]; then
|
||||||
LETSENCRYPT_URL=STAGING_URL
|
letsencrypt_url=STAGING_URL
|
||||||
echo "Staging on"
|
echo "Staging on"
|
||||||
else
|
else
|
||||||
LETSENCRYPT_URL=PRODUCTION_URL
|
letsencrypt_url=PRODUCTION_URL
|
||||||
echo "Production on"
|
echo "Production on"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
certbot certonly --agree-tos --keep -n --text --email $2 --server \
|
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
|
--standalone --standalone-supported-challenges http-01 --debug
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue