Skip to content
Snippets Groups Projects
Commit a2bc9502 authored by FFS-Roland's avatar FFS-Roland
Browse files

bug fix: due to possible invalid systemtime, using counter instead of time.

parent c22cea54
No related branches found
No related tags found
No related merge requests found
...@@ -9,21 +9,23 @@ FFS=/tmp/.gw.ffs ...@@ -9,21 +9,23 @@ FFS=/tmp/.gw.ffs
if [ "$(uci get gluon-setup-mode.@setup_mode[0].enabled)" = "0" ] && if [ "$(uci get gluon-setup-mode.@setup_mode[0].enabled)" = "0" ] &&
[ "$(uci get system.@system[0].enable_watchdog)" != "0" ] && [ "$(uci get system.@system[0].enable_watchdog)" != "0" ] &&
[ "$(netstat -nt | grep -c ':22')" = "0" ]; then [ "$(netstat -nt | grep -c ':22')" = "0" ]; then
NOW=$(date +%s)
if [ -n "$(batctl gwl | grep '=>')" ]; then if [ -n "$(batctl gwl | grep '=>')" ]; then
echo $NOW >$FFS echo 0 >$FFS
logger -t $ME "node is online" logger -t $ME "node is online"
else else
if [ -f $FFS ]; then if [ -f $FFS ]; then
OFF=$(cat $FFS) OFF=$(cat $FFS)
DELTA=$((NOW - OFF)) else
logger -t $ME "offline for ${DELTA} sec." OFF=0
fi
logger -t $ME "offline count: ${OFF}"
if [ $DELTA -gt 3500 ]; then if [ $OFF -gt 10 ]; then
reboot reboot
fi
else else
echo $NOW >$FFS echo $((OFF+1)) >$FFS
fi fi
fi fi
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment