From f4847d768ace94e6594d0a08e47631f3deaf5912 Mon Sep 17 00:00:00 2001 From: Eneko Date: Tue, 21 Jul 2026 23:19:40 +0200 Subject: [PATCH] feat: start after ntp. Check time is valid. --- limitator | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/limitator b/limitator index 33a52b8..765fab1 100644 --- a/limitator +++ b/limitator @@ -1,5 +1,5 @@ #!/bin/sh /etc/rc.common -START=95 +START=99 STOP=01 EXTRA_COMMANDS="save reset show json" @@ -147,7 +147,23 @@ set_iptables_rule(){ iptables -I $IPTABLES_OUTPUT -o $WAN_DEV ! -d $INTRANET -j $IPTABLES_CHAIN } +check_time_is_valid(){ + local current_time=$(date +'%s') + local retries=0 + + while [ $current_time -lt 1780000000 ]; do + if [ $retries -ge 60 ]; then + echo "No valid date after 60 retries, exiting" >> $LOG_FILE + exit 1 + fi + sleep 10 + ((retries++)) + current_time=$(date +'%s') + done +} + start() { + check_time_is_valid set_iptables_rule }