Skip to content

Commit 0781e8c

Browse files
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.
1 parent f2d3500 commit 0781e8c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

acme.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5590,6 +5590,7 @@ installcronjob() {
55905590
fi
55915591
_t=$(_time)
55925592
random_minute=$(_math $_t % 60)
5593+
random_hour=$(_math $_t / 60 % 24)
55935594

55945595
if ! _exists "$_CRONTAB" && _exists "fcrontab"; then
55955596
_CRONTAB="fcrontab"
@@ -5616,12 +5617,12 @@ installcronjob() {
56165617
if _exists uname && uname -a | grep SunOS >/dev/null; then
56175618
$_CRONTAB -l | {
56185619
cat
5619-
echo "$random_minute 0 * * * $lesh --cron --home \"$LE_WORKING_DIR\" $_c_entry> /dev/null"
5620+
echo "$random_minute $random_hour * * * $lesh --cron --home \"$LE_WORKING_DIR\" $_c_entry> /dev/null"
56205621
} | $_CRONTAB --
56215622
else
56225623
$_CRONTAB -l | {
56235624
cat
5624-
echo "$random_minute 0 * * * $lesh --cron --home \"$LE_WORKING_DIR\" $_c_entry> /dev/null"
5625+
echo "$random_minute $random_hour * * * $lesh --cron --home \"$LE_WORKING_DIR\" $_c_entry> /dev/null"
56255626
} | $_CRONTAB -
56265627
fi
56275628
fi

0 commit comments

Comments
 (0)