mwan3: rename uptime to online
authorFlorian Eckert <fe@dev.tdt.de>
Fri, 28 Jun 2019 10:39:05 +0000 (12:39 +0200)
committerFlorian Eckert <fe@dev.tdt.de>
Fri, 15 Nov 2019 08:39:17 +0000 (09:39 +0100)
Rename uptime ubus output from mwan3 to online.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
(cherry picked from commit 3be40786f54b5d6534ddd6a58c090b3963180eed)

net/mwan3/files/usr/libexec/rpcd/mwan3
net/mwan3/files/usr/sbin/mwan3track

index d31ee63bcef0eea5755334de8ef1d81add908422..51cc6989ed6bd383d040cb5abfbe79fd79decd71 100755 (executable)
@@ -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")"
index 09ee3c119b951790cd5f0c370830f68f4e2982d8..a18bbd4c194f6bc88237e962d0f2526c9cd0b792 100755 (executable)
@@ -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