diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 2689b7f449..f08cd3b537 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -595,8 +595,7 @@ generate_systemd_calendar() { } generate_cron_schedule() { - local interval_hours="$1" - local total_seconds=$(echo "$interval_hours * 3600" | bc) + local total_seconds=$(echo "$1 * 3600" | bc) local schedule_script="/opt/pihole/speedtestmod/schedule_check.sh" if (( $(echo "$total_seconds < 60" | bc -l) )) && (( $(echo "$total_seconds > 0" | bc -l) )); then @@ -606,7 +605,7 @@ generate_cron_schedule() { if [[ ! "$total_seconds" =~ ^-?([0-9]+(\.[0-9]*)?|\.[0-9]+)$ ]]; then total_seconds="nan" - else + elif (( $(echo "$total_seconds > 0" | bc -l) )); then remainder=$(echo "$total_seconds % 60" | bc) if [ $(echo "$remainder < 30" | bc) -eq 1 ]; then total_seconds=$(echo "$total_seconds - $remainder" | bc)