Skip to content

Commit

Permalink
Merge pull request #944 from MarcelWaldvogel/random-cron
Browse files Browse the repository at this point in the history
Random cron
  • Loading branch information
Neilpang authored Sep 13, 2023
2 parents 1a90f66 + 92dbe6c commit 0c8870c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions acme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5993,6 +5993,7 @@ installcronjob() {
fi
_t=$(_time)
random_minute=$(_math $_t % 60)
random_hour=$(_math $_t / 60 % 24)

if ! _exists "$_CRONTAB" && _exists "fcrontab"; then
_CRONTAB="fcrontab"
Expand All @@ -6017,16 +6018,14 @@ installcronjob() {
_info "Installing cron job"
if ! $_CRONTAB -l | grep "$PROJECT_ENTRY --cron"; then
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 --
_CRONTAB_STDIN="$_CRONTAB --"
else
$_CRONTAB -l | {
cat
echo "$random_minute 0 * * * $lesh --cron --home \"$LE_WORKING_DIR\" $_c_entry> /dev/null"
} | $_CRONTAB -
_CRONTAB_STDIN="$_CRONTAB -"
fi
$_CRONTAB -l | {
cat
echo "$random_minute $random_hour * * * $lesh --cron --home \"$LE_WORKING_DIR\" $_c_entry> /dev/null"
} | $_CRONTAB_STDIN
fi
if [ "$?" != "0" ]; then
_err "Install cron job failed. You need to manually renew your certs."
Expand Down

0 comments on commit 0c8870c

Please sign in to comment.