How can I check PPPoE uptime via SSH?

I know checking WAN uptime when using DHCP isn't usually straight forward, but I use PPPoE, and the reported WAN uptime on the status page is always accurate.

I was wondering if it's somehow possible to obtain this when logged in via SSH. For example, "uptime" displays the device uptime, so I was wondering if there's an equivalent command to display the WAN uptime.

Thanks.

As a quick manual check:

ifstatus wan | grep uptime

For scripting:

#!/bin/sh

. /usr/share/libubox/jshn.sh

json_load "$(ifstatus wan)"

json_get_var wan_up up
json_get_var wan_uptime uptime

echo "wan is up: $wan_up"
echo "wan uptime: $wan_uptime"
2 Likes

Thanks. I get the following. I assume it's in seconds!

root@OpenWrt:~# ifstatus wan | grep uptime
"uptime": 21088,
root@OpenWrt:~#