summaryrefslogtreecommitdiffstats
path: root/.local/bin/status/sb-cpu
diff options
context:
space:
mode:
authorJoe <rrbo@proton.me>2023-06-14 12:30:07 +0200
committerJoe <rrbo@proton.me>2023-06-14 12:30:07 +0200
commitf964c2cb48308d98b83ae92448a201e9f8a30cea (patch)
treee8eb77260fdcaaaa03200c4e865b81d285f2ac66 /.local/bin/status/sb-cpu
parentup (diff)
downloaddotfiles-bsd-f964c2cb48308d98b83ae92448a201e9f8a30cea.tar.gz
dotfiles-bsd-f964c2cb48308d98b83ae92448a201e9f8a30cea.tar.bz2
dotfiles-bsd-f964c2cb48308d98b83ae92448a201e9f8a30cea.tar.xz
dotfiles-bsd-f964c2cb48308d98b83ae92448a201e9f8a30cea.tar.zst
dotfiles-bsd-f964c2cb48308d98b83ae92448a201e9f8a30cea.zip
up
Diffstat (limited to '.local/bin/status/sb-cpu')
-rwxr-xr-x.local/bin/status/sb-cpu14
1 files changed, 12 insertions, 2 deletions
diff --git a/.local/bin/status/sb-cpu b/.local/bin/status/sb-cpu
index 7770bdb..3eba1cb 100755
--- a/.local/bin/status/sb-cpu
+++ b/.local/bin/status/sb-cpu
@@ -9,8 +9,18 @@
printf " "
# for i in $(top -P -d 2 -s 0.2 | grep '^CPU' | tail -n$ncpu | sed '{s/% idle$//;s/.*[[:blank:]]//;s/\..*//;s/^/100 - /;}' | bc); do
-stats=$(top -d 2 -s 0.2 | grep -E 'load averages:|^CPU')
-printf "%s " "$(echo "$stats" | sed '{1,2d;4d;s/.*averages: *//;s/,.*//;}')"
+case $(hostname -s) in
+ mother|po-rbo)
+ stats=$(uptime | head -n1)
+ printf "%s " "$(echo "$stats" | sed 's/.*average: *//;s/,.*//')"
+ return
+ ;;
+ mars)
+ stats=$(top -d 2 -s 0.2 | grep -E 'load averages:|^CPU')
+ printf "%s " "$(echo "$stats" | sed '{1,2d;4d;s/.*averages: *//;s/,.*//;}')"
+ ;;
+esac
+
case $(echo "$stats" | sed '{1,3d;s/% idle$//;s/.*[[:blank:]]//;s/\..*//;s/^/(100 - /;s/$/) \/ 12\.5/;}' | bc) in
"0") printf "[ ]\n";;
"1") printf "[= ]\n";;