diff options
| author | navewindre <boneyaard@gmail.com> | 2025-07-13 01:45:05 +0200 |
|---|---|---|
| committer | navewindre <boneyaard@gmail.com> | 2025-07-13 01:45:05 +0200 |
| commit | d49e4b0a25c7cc75ade210c7092eea8feb75e692 (patch) | |
| tree | 2a38c3846dee25d0d83c820de6bade62f54db90f /home/.panel2.sh | |
| parent | 1fe841b80b6284737661870c87abbc26ecba4109 (diff) | |
restructure
Diffstat (limited to 'home/.panel2.sh')
| -rwxr-xr-x | home/.panel2.sh | 17 |
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 |" + |
