1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00
openmptcprouter-feeds/luci-app-ouad/root/usr/sbin/status_interfaces.sh
Ycarus (Yannick Chabanois) 6fa256c456 First version for oled
2023-10-07 08:34:48 +02:00

26 lines
No EOL
696 B
Bash
Executable file

#!/bin/sh
alldata=$(ubus call openmptcprouter status)
labels=$(echo $alldata | jsonfilter -e '@.wans[@.multipath!="off"].label')
for wan in $labels; do
wandata=$(echo $alldata | jsonfilter -e "@.wans[@.label=\"${wan}\"]")
status=$(echo $wandata | jsonfilter -e '@.status')
signal=$(echo $wandata | jsonfilter -e '@.signal')
echo -n "$wan $status "
if [ "$signal" != "" ]; then
if [ "$signal" -eq "0" ]; then
echo -n "0/4"
elif [ "$signal" -lt "25" ]; then
echo -n "1/4"
elif [ "$signal" -lt "50" ]; then
echo -n "2/4"
elif [ "$signal" -lt "75" ]; then
echo -n "3/4"
else
echo -n "4/4"
fi
else
echo -n "$(echo $wandata | jsonfilter -e '@.state')"
fi
echo
done