Fixed timing to be 0-3

This commit is contained in:
2025-10-23 18:40:26 +03:00
parent f2f1c76a65
commit 2b91fe1a52

View File

@@ -116,8 +116,8 @@ dispatch_task() {
# now, today 01:00, tomorrow 01:00 (local time)
local now_s today1_s tomorrow1_s next1_s diff_s ceil_h rnd extra_h total_h
now_s="$(date +%s)"
today1_s="$(date -d 'today 01:00' +%s)"
tomorrow1_s="$(date -d 'tomorrow 01:00' +%s)"
today1_s="$(date -d 'today 00:00' +%s)"
tomorrow1_s="$(date -d 'tomorrow 00:00' +%s)"
if (( now_s < today1_s )); then
next1_s="$today1_s"
else
@@ -127,7 +127,7 @@ dispatch_task() {
# Ceil hours so current minutes are preserved as in your examples
ceil_h=$(( (diff_s + 3599) / 3600 ))
rnd=$(( (RANDOM % 4) + 1 )) # 1..4
total_h=$(( ceil_h + rnd ))
total_h=$(( ceil_h + rnd - 1 ))
extra_nbplay_opts+=("-erebootin=${total_h}")
log "Resolved '${task}' → base='${base_task}', rebootin=${total_h}h (ceil_to_1am=${ceil_h}h + rand=${rnd}h)"