summaryrefslogtreecommitdiff
path: root/home/.panel2.sh
diff options
context:
space:
mode:
authornavewindre <boneyaard@gmail.com>2025-07-13 01:45:05 +0200
committernavewindre <boneyaard@gmail.com>2025-07-13 01:45:05 +0200
commitd49e4b0a25c7cc75ade210c7092eea8feb75e692 (patch)
tree2a38c3846dee25d0d83c820de6bade62f54db90f /home/.panel2.sh
parent1fe841b80b6284737661870c87abbc26ecba4109 (diff)
restructure
Diffstat (limited to 'home/.panel2.sh')
-rwxr-xr-xhome/.panel2.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/home/.panel2.sh b/home/.panel2.sh
new file mode 100755
index 0000000..be609e1
--- /dev/null
+++ b/home/.panel2.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# Get CPU usage
+cpu_usage=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print int(100 - $1)"%"}')
+
+# Get free space on root drive
+free_space=$(df -h / | awk '/\// {print $4}')
+
+if command -v nvidia-smi &> /dev/null; then
+ gpu_usage=$(nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits | awk '{print $1"%"}')
+ gpu_info="| GPU: $gpu_usage"
+else
+ gpu_info=""
+fi
+
+echo " CPU: $cpu_usage $gpu_info | ヂスク: $free_space |"
+