Skip to content

Commit 46cd121

Browse files
committed
Fix cron interval normalization for 24h and 60m
1 parent 3db6767 commit 46cd121

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

  • root/etc/s6-overlay/s6-rc.d/init-duckdns

root/etc/s6-overlay/s6-rc.d/init-duckdns/run

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ case "$UPDATE_INTERVAL" in
2121
echo "Update interval must be between 1-24 hours"
2222
exit 1
2323
fi
24-
HOURS="*/$HOURS"
25-
26-
# We want a single run per selected hour, with the template's jitter handling
27-
# the exact seconds.
24+
# Cron hour field is 0-23, so 24h must be normalized to daily at midnight.
25+
if (( HOURS == 24 )); then
26+
HOURS="0"
27+
else
28+
HOURS="*/$HOURS"
29+
fi
2830
MINUTES="0"
2931
;;
3032
*)
@@ -33,9 +35,13 @@ case "$UPDATE_INTERVAL" in
3335
echo "Update interval must be between 5-60 minutes"
3436
exit 1
3537
fi
36-
MINUTES="*/$MINUTES"
37-
3838
HOURS="*"
39+
# Cron minute field is 0-59, so 60m must be normalized to top of each hour.
40+
if (( MINUTES == 60 )); then
41+
MINUTES="0"
42+
else
43+
MINUTES="*/$MINUTES"
44+
fi
3945
;;
4046
esac
4147

0 commit comments

Comments
 (0)