Browse Source
Merge pull request #944 from MarcelWaldvogel/random-cron
Random cron
pull/4805/head
neil
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
8 deletions
-
acme.sh
|
|
@ -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" |
|
|
@ -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." |
|
|
|