Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- then=$(sysctl kern.boottime | awk '{print $5}' | sed "s/,//")
- now=$(date +%s)
- diff=$(($now-$then))
- days=$(($diff/86400));
- diff=$(($diff-($days*86400)))
- hours=$(($diff/3600))
- diff=$(($diff-($hours*3600)))
- minutes=$(($diff/60))
- seconds=$(($diff-($minutes*60)))
- printf "Uptime: %dd%02dh%02dm%02ds" $days $hours $minutes $seconds
Add Comment
Please, Sign In to add comment