aboutsummaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2020-07-20 15:40:08 +0200
committerPatrick Spek <p.spek@tyil.nl>2021-08-14 11:59:41 +0200
commitdc7f2d7fcf096609cee6a3a12fb0dfcf2aa7ea5b (patch)
tree8e1ce8690a830c61da315535e0aa2be0cc135e74 /.local
parentd9aff489786d44089a327d7bec242d722387fb3b (diff)
Update load script to have multiple sources to attempt
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/load16
1 files changed, 14 insertions, 2 deletions
diff --git a/.local/bin/load b/.local/bin/load
index e751bcf..29ef646 100755
--- a/.local/bin/load
+++ b/.local/bin/load
@@ -1,8 +1,20 @@
-#!/usr/bin/env sh
+#!/bin/sh
main()
{
- awk '{print $1, $2, $3}' /proc/loadavg
+ if [ -f /proc/loadavg ]
+ then
+ awk '{print $1, $2, $3}' /proc/loadavg
+ return
+ fi
+
+ if [ -x uptime ]
+ then
+ uptime | awk '{ print $(NF-2)" "$(NF-1)" "$(NF-0)}' | sed 's/,//g'
+ return
+ fi
+
+ return 1
}
main "$@"