mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-05-08 22:12:44 +00:00
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.
This commit is contained in:
parent
cae6c8e5f5
commit
12ee24eedc
16
acme.sh
16
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."
|
||||
|
Loading…
x
Reference in New Issue
Block a user