diff options
| author | navewindre <boneyaard@gmail.com> | 2024-10-25 14:32:46 +0200 |
|---|---|---|
| committer | navewindre <boneyaard@gmail.com> | 2024-10-25 14:32:46 +0200 |
| commit | f08ae75621b31466213559e041221a8ac1434ff5 (patch) | |
| tree | 99d877a618c64d4cadce9f1c634917bd0eada35b /panel2.sh | |
| parent | 5f07f79504e4776f2d68dbd6f99a9353c6d0441b (diff) | |
panels
Diffstat (limited to 'panel2.sh')
| -rwxr-xr-x | panel2.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/panel2.sh b/panel2.sh new file mode 100755 index 0000000..be609e1 --- /dev/null +++ b/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 |" + |
