Low disc space alert script

A script which checks available disc space every 32 seconds. Addidional (CPU usage and memory usage) features are not on, but user can edit the script. Low disc alert can stop using command pkill Low-disc-alert

Low-disk-alert-stopper.zip

Low-disk-alert-stopper:

#!/bin/bash
# RJP 22.3.2025 Low-disc-alert stopper
#
pkill Low-disc-alert

Low-disc-alert.zip

Low-disc-alert:

#!/bin/bash
##
# RJP 22.3.2025 CPU, memory and disk space alert script
# Turn on extra features if you want
# The script can place to the startup
# Values can modify by editing echo lines
# to stop the scrip run pkill general-alerts
while true; do
#touch /tmp/maxCPU

# Set max CPU usage which launches CPU alert
#echo "50" > /tmp/maxCPU
#touch /tmp/maxmemory
# Set max memory usage which launches memory alert
#echo "70" > /tmp/maxmemory
touch /tmp/maxspace
# Set max space usage which launches space alert
echo "90" > /tmp/maxspace
#
#top -b -n 1 | awk '/%Cpu/{print $2}' > /tmp/CPU0
#awk -v FS=',' '{print $1}' /tmp/CPU0 > /tmp/CPU
#free -m | awk '/Mem/{printf("%.2f", $3/$2*100)}' > /tmp/memory0
#awk -v FS='.' '{print $1}' /tmp/memory0 > /tmp/memory
df -h / | awk '/\//{print $5}' | sed 's/%//' > /tmp/space
# Extra feature which is off
#if [[ "$(cat /tmp/CPU)" -gt "$(cat /tmp/maxCPU)" ]]
#then
#yad --width=400 --text-align=center --center --title=$"Current CPU usage" --text="
#CPU usage was $(cat /tmp/CPU)%
# "
#fi
# Extra feature which is off
#if [[ "$(cat /tmp/memory)" -gt "$(cat /tmp/maxmemory)" ]]
#then
#yad --width=400 --text-align=center --center --title=$"Current memory usage" --text="
#Memory usage was $(cat /tmp/memory)%
# "
#fi

if [[ "$(cat /tmp/space)" -gt "$(cat /tmp/maxspace)" ]]
then
yad --width=400 --text-align=center --center --title=$"Current disk usage" --text="
Disk usage is $(cat /tmp/space)%
"
fi
sleep 2
cd /tmp && rm CPU0 CPU maxCPU memory0 memory maxmemory maxspace space
sleep 30
done