@ -69,6 +69,26 @@ report_policies_v6() {
done
}
get_age() {
local time_p time_u
iface="$1"
time_p="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/TIME")"
[ -z "${time_p}" ] || {
time_n="$(get_uptime)"
echo $((time_n-time_p))
}
}
get_offline_time() {
local time_n time_d iface
iface="$1"
time_d="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/OFFLINE")"
[ -z "${time_d}" ] || [ "${time_d}" = "0" ] || {
time_n="$(get_uptime)"
echo $((time_n-time_d))
}
}
get_mwan3_status() {
local iface="${1}"
local iface_select="${2}"
@ -85,23 +105,9 @@ get_mwan3_status() {
track_status="$(mwan3_get_mwan3track_status "$1")"
[ "$track_status" = "active" ] && running="1"
time_p="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/TIME")"
[ -z "${time_p}" ] || {
time_n="$(get_uptime)"
let age=time_n-time_p
}
time_u="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/ONLINE")"
[ -z "${time_u}" ] || [ "${time_u}" = "0" ] || {
time_n="$(get_uptime)"
let online=time_n-time_u
}
time_d="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/OFFLINE")"
[ -z "${time_d}" ] || [ "${time_d}" = "0" ] || {
time_n="$(get_uptime)"
let offline=time_n-time_d
}
age=$(get_age "$iface")
online=$(get_online_time "$iface")
offline=$(get_offline_time "$iface")
local uptime="0"