summaryrefslogtreecommitdiff
path: root/bin/common
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-08-14 12:37:09 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-08-14 12:37:09 +0200
commit22d2c57240e65df482e30fbe684844c6b173aca2 (patch)
tree2f7b9b559f349f69c7c4200bf55756f9ab099833 /bin/common
parentb0ef0738b3f0cebde9ed6b1d40ca0f7cbb1385a3 (diff)
[saf] added load function
Diffstat (limited to 'bin/common')
-rwxr-xr-xbin/common/saf11
1 files changed, 10 insertions, 1 deletions
diff --git a/bin/common/saf b/bin/common/saf
index 0c6fbc4..dcc43d5 100755
--- a/bin/common/saf
+++ b/bin/common/saf
@@ -7,6 +7,15 @@ green="$(printf '\033[32m')"
blue="$(printf '\033[34m')"
reset="$(printf '\033[0m')"
+load ()
+{
+ for time in $(uptime | cut -f3- -d',' | cut -f2 -d':' | tr ',' ' ')
+ do
+ percent="$(echo "$time*100/$(nproc)" | bc)"
+ echo "${percent:-0}%"
+ done | xargs
+}
+
for file in /etc/os-release /usr/lib/os-release
do
[ -f "$file" ] && . "$file" && break
@@ -19,6 +28,6 @@ SHELL="$(basename "$SHELL")"
cat <<EOF
${red}- ${blue}${ID:-"unknown"}
${red}- ${blue}$KERNEL
- ${red}- ${blue}$UPTIME
+ ${red}- ${blue}$UPTIME ($(load))
${red}- ${blue}$SHELL${reset}
EOF