Bash script or command to get current uptime

Is this the right area to ask this? Sorry if it isn't...

But I'm looking for a command or bash script to know how long since the last boot (in secs hopefully) of the router? I need to adjust 2 or 3 scripts not to run upon boot, but only run if I restart the service(s).

Thanks in advance for any help regarding this.

echo $(cat /proc/uptime | awk '{print $1}')
echo $(cat /proc/uptime | cut -d ' ' -f 1)

The output is in seconds

3 Likes

Thanks so much

ubus call system info | jsonfilter -e "@['uptime']"
2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.