Browse Source

mwan3: rename downtime to offline

Rename downtime ubus output from mwan3 to offline.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
lilik-openwrt-22.03
Florian Eckert 5 years ago
parent
commit
6c2cd78c6f
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

@ -75,7 +75,7 @@ get_mwan3_status() {
local running="0"
local age=0
local online=0
local downtime=0
local offline=0
local pid device time_p time_n time_u time_d
network_get_device device $1
@ -98,16 +98,16 @@ get_mwan3_status() {
let online=time_n-time_u
}
time_d="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/DOWNTIME")"
time_d="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/OFFLINE")"
[ -z "${time_d}" ] || [ "${time_d}" = "0" ] || {
time_n="$(get_uptime)"
let downtime=time_n-time_d
let offline=time_n-time_d
}
json_add_object "${iface}"
json_add_int age "$age"
json_add_int online "${online}"
json_add_int downtime "${downtime}"
json_add_int offline "${offline}"
json_add_int "score" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/SCORE")"
json_add_int "lost" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/LOST")"
json_add_int "turn" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/TURN")"


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

@ -115,11 +115,11 @@ main() {
if [ "$STATUS" = "offline" ]; then
echo "offline" > /var/run/mwan3track/$1/STATUS
echo "0" > /var/run/mwan3track/$1/ONLINE
echo "$(get_uptime)" > /var/run/mwan3track/$1/DOWNTIME
echo "$(get_uptime)" > /var/run/mwan3track/$1/OFFLINE
score=0
else
echo "online" > /var/run/mwan3track/$1/STATUS
echo "0" > /var/run/mwan3track/$1/DOWNTIME
echo "0" > /var/run/mwan3track/$1/OFFLINE
echo "$(get_uptime)" > /var/run/mwan3track/$1/ONLINE
env -i ACTION="connected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface
fi
@ -260,7 +260,7 @@ main() {
if [ "${IFDOWN_EVENT}" -eq 1 ]; then
echo "offline" > /var/run/mwan3track/$1/STATUS
echo "$(get_uptime)" > /var/run/mwan3track/$1/DOWNTIME
echo "$(get_uptime)" > /var/run/mwan3track/$1/OFFLINE
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


Loading…
Cancel
Save