Browse Source

Use random hour for cron job

The hour for the cron job isn't really random (as is the minute),
but assuming acme.sh installation times are not correlated, neither
will be the resulting cron start times.
pull/944/head
Marcel Waldvogel 4 years ago
parent
commit
0781e8cf12
  1. 5
      acme.sh

5
acme.sh

@ -5590,6 +5590,7 @@ installcronjob() {
fi fi
_t=$(_time) _t=$(_time)
random_minute=$(_math $_t % 60) random_minute=$(_math $_t % 60)
random_hour=$(_math $_t / 60 % 24)
if ! _exists "$_CRONTAB" && _exists "fcrontab"; then if ! _exists "$_CRONTAB" && _exists "fcrontab"; then
_CRONTAB="fcrontab" _CRONTAB="fcrontab"
@ -5616,12 +5617,12 @@ installcronjob() {
if _exists uname && uname -a | grep SunOS >/dev/null; then if _exists uname && uname -a | grep SunOS >/dev/null; then
$_CRONTAB -l | { $_CRONTAB -l | {
cat cat
echo "$random_minute 0 * * * $lesh --cron --home \"$LE_WORKING_DIR\" $_c_entry> /dev/null"
echo "$random_minute $random_hour * * * $lesh --cron --home \"$LE_WORKING_DIR\" $_c_entry> /dev/null"
} | $_CRONTAB -- } | $_CRONTAB --
else else
$_CRONTAB -l | { $_CRONTAB -l | {
cat cat
echo "$random_minute 0 * * * $lesh --cron --home \"$LE_WORKING_DIR\" $_c_entry> /dev/null"
echo "$random_minute $random_hour * * * $lesh --cron --home \"$LE_WORKING_DIR\" $_c_entry> /dev/null"
} | $_CRONTAB - } | $_CRONTAB -
fi fi
fi fi

Loading…
Cancel
Save