Browse Source

mwan3: rename uptime to online

Rename uptime ubus output from mwan3 to online.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
lilik-openwrt-22.03
Florian Eckert 5 years ago
parent
commit
3be40786f5
2 changed files with 7 additions and 7 deletions
  1. +4
    -4
      net/mwan3/files/usr/libexec/rpcd/mwan3
  2. +3
    -3
      net/mwan3/files/usr/sbin/mwan3track

+ 4
- 4
net/mwan3/files/usr/libexec/rpcd/mwan3 View File

@ -74,7 +74,7 @@ get_mwan3_status() {
local iface_select="${2}"
local running="0"
local age=0
local uptime=0
local online=0
local downtime=0
local pid device time_p time_n time_u time_d
@ -92,10 +92,10 @@ get_mwan3_status() {
let age=time_n-time_p
}
time_u="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/UPTIME")"
time_u="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/ONLINE")"
[ -z "${time_u}" ] || [ "${time_u}" = "0" ] || {
time_n="$(get_uptime)"
let uptime=time_n-time_u
let online=time_n-time_u
}
time_d="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/DOWNTIME")"
@ -106,7 +106,7 @@ get_mwan3_status() {
json_add_object "${iface}"
json_add_int age "$age"
json_add_int uptime "${uptime}"
json_add_int online "${online}"
json_add_int downtime "${downtime}"
json_add_int "score" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/SCORE")"
json_add_int "lost" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/LOST")"


+ 3
- 3
net/mwan3/files/usr/sbin/mwan3track View File

@ -114,13 +114,13 @@ main() {
if [ "$STATUS" = "offline" ]; then
echo "offline" > /var/run/mwan3track/$1/STATUS
echo "0" > /var/run/mwan3track/$1/UPTIME
echo "0" > /var/run/mwan3track/$1/ONLINE
echo "$(get_uptime)" > /var/run/mwan3track/$1/DOWNTIME
score=0
else
echo "online" > /var/run/mwan3track/$1/STATUS
echo "0" > /var/run/mwan3track/$1/DOWNTIME
echo "$(get_uptime)" > /var/run/mwan3track/$1/UPTIME
echo "$(get_uptime)" > /var/run/mwan3track/$1/ONLINE
env -i ACTION="connected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface
fi
while true; do
@ -261,7 +261,7 @@ main() {
if [ "${IFDOWN_EVENT}" -eq 1 ]; then
echo "offline" > /var/run/mwan3track/$1/STATUS
echo "$(get_uptime)" > /var/run/mwan3track/$1/DOWNTIME
echo "0" > /var/run/mwan3track/$1/UPTIME
echo "0" > /var/run/mwan3track/$1/ONLINE
$LOG notice "Interface $1 ($2) is offline"
env -i ACTION="disconnected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface
score=0


Loading…
Cancel
Save