Outstanding proposal.
My last improved version is below:
- click on an icon on the gnome desktop (which execute this script; .desktop file in the bottom of the message),
- a window pop up,
- it stay open for 30s,
- then it goes alone away (no need to close or further act).
executable script check_ram.sh
Quote:
#! /bin/bash
THRESHOLD=5 # Set your desired threshold percentage
# https://www.inmotionhosting.com/supp...-memory-usage/
RAM=$(free | awk '/Speicher/{printf("%.2f"), $3/$2*100}')
if [ $(echo "$RAM > $THRESHOLD" | bc) -eq 1 ]; then
gnome-terminal --geometry=50x10 -- bash -c "echo 'RAM usage is above $THRESHOLD% - Current usage: $RAM%'; sleep 30; exit; exec bash"
fi
|
file RAM.desktop in /home/userX/Schreibtisch
Quote:
[Desktop Entry]
Name=RAM check
Comment=this is an icon for checking the RAM use
Exec=bash /home/userX/pc_issues/RAM/check_ram.sh
Type=Application
Terminal=false
Icon=/home/userX/pc_issues/RAM/ram.jpeg
|
UPDATE (added: indication of the used swap in a new line)
Quote:
#! /bin/bash
THRESHOLD=5 # Set your desired threshold percentage
RAM=$(free | awk '/Speicher/{printf("%.1f"), $3/$2*100}')
SWAP=$(free | awk '/Speicher/{printf("%.0f"), $8}')
if [ $(echo "$RAM > $THRESHOLD" | bc) -eq 1 ]; then
gnome-terminal --geometry=63x5 -- bash -c "echo 'RAM usage is above $THRESHOLD% - Current usage: $RAM%' ; printf %b '\n' ; echo 'SWAP used: $SWAP'; sleep 15; exit; exec bash"
fi
|