summaryrefslogtreecommitdiffstats
path: root/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-x.local/bin/status/sb-cpu14
-rwxr-xr-x.local/bin/status/sb-net8
-rwxr-xr-x.local/bin/status/sb-os10
3 files changed, 22 insertions, 10 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";;
diff --git a/.local/bin/status/sb-net b/.local/bin/status/sb-net
index 87d2438..50cc9a5 100755
--- a/.local/bin/status/sb-net
+++ b/.local/bin/status/sb-net
@@ -1,9 +1,13 @@
#!/bin/sh
-if ifconfig | grep '^tun' >/dev/null 2>&1; then
+case $(hostname -s) in
+ mother|po-rbo) ping="ping -c1 -w1 1.1.1.1" ;;
+ mars) ping="ping -c1 -t1 1.1.1.1" ;;
+esac
+if ifconfig | grep -E '^tun|^vpn' >/dev/null 2>&1; then
echo -n " "
fi
-if ! ping -q -c1 -t1 1.1.1.1 >/dev/null 2>&1; then
+if ! $ping >/dev/null 2>&1; then
echo "ﰸ "
return
fi
diff --git a/.local/bin/status/sb-os b/.local/bin/status/sb-os
index 820ce47..5f0973e 100755
--- a/.local/bin/status/sb-os
+++ b/.local/bin/status/sb-os
@@ -1,11 +1,9 @@
#!/bin/sh
-os=$(uname)
-
-case $os in
- "FreeBSD") os="" ;;
- "Linux") os="" ;;
- *) return ;;
+case $(hostname -s) in
+ mother) os="" ;;
+ po-rbo) os="" ;;
+ mars) os="" ;;
esac
echo "$os "