feat: start after ntp. Check time is valid.
This commit is contained in:
1 parent
6e8391545b
commit
f4847d768a
1 file changed
+17
-1
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
START=95
|
START=99
|
||||||
STOP=01
|
STOP=01
|
||||||
|
|
||||||
EXTRA_COMMANDS="save reset show json"
|
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
|
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() {
|
start() {
|
||||||
|
check_time_is_valid
|
||||||
set_iptables_rule
|
set_iptables_rule
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user