From f08ae75621b31466213559e041221a8ac1434ff5 Mon Sep 17 00:00:00 2001 From: navewindre Date: Fri, 25 Oct 2024 14:32:46 +0200 Subject: panels --- panel.sh | 18 ++++++++++++++++++ panel2.sh | 17 +++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 panel.sh create mode 100755 panel2.sh diff --git a/panel.sh b/panel.sh new file mode 100755 index 0000000..6d0e225 --- /dev/null +++ b/panel.sh @@ -0,0 +1,18 @@ +#!/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 |" + 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 |" + -- cgit v1.2.3