From 12ee24eedc94f6ee863b3a401c0ee58cbfc66bb4 Mon Sep 17 00:00:00 2001 From: Marcel Waldvogel Date: Sun, 16 Jul 2017 20:43:41 +0200 Subject: [PATCH] Make cron run twice a day, randomly Run cron twice a day to make sure certificates are guaranteed to be renewed at least once during the last 24 hours of the certificate lifetime. --- acme.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/acme.sh b/acme.sh index 486f8678..8f60550a 100755 --- a/acme.sh +++ b/acme.sh @@ -4420,17 +4420,17 @@ installcronjob() { fi _t=$(_time) random_minute=$(_math $_t % 60) + random_hour1=$(_math $_t / 60 % 12) + random_hour2=$(_math $random_hour1 + 12) if _exists uname && uname -a | grep SunOS >/dev/null; then - crontab -l | { - cat - echo "$random_minute 0 * * * $lesh --cron --home \"$LE_WORKING_DIR\" $_c_entry> /dev/null" - } | crontab -- + ct_stdin=-- else - crontab -l | { - cat - echo "$random_minute 0 * * * $lesh --cron --home \"$LE_WORKING_DIR\" $_c_entry> /dev/null" - } | crontab - + ct_stdin=- fi + crontab -l | { + cat + echo "$random_minute $random_hour1,$random_hour2 * * * $lesh --cron --home \"$LE_WORKING_DIR\" $_c_entry> /dev/null" + } | crontab $ct_stdin fi if [ "$?" != "0" ]; then _err "Install cron job failed. You need to manually renew your certs."