Last active
October 13, 2021 19:08
-
-
Save andrewp-as-is/b4ce7c690eee348fa626b555dba2ad3b to your computer and use it in GitHub Desktop.
sysctl boottime #sysctl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sysctl -n kern.boottime | |
sysctl -n kern.boottime | awk '{split($0,a,",");print a[1]}' | grep -oE "[[:digit:]]{1,}" | |
uptime=$(sysctl -n kern.boottime | awk '{split($0,a,",");print a[1]}' | grep -oE "[[:digit:]]{1,}") | |
now=$(date +%s) | |
echo $((now-uptime)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment