add: check storage script
This commit is contained in:
commit
3f953ec88a
29
scripts/check_storage.sh
Executable file
29
scripts/check_storage.sh
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
trap 'exit 1' INT
|
||||
|
||||
#Colours
|
||||
greenColour="\e[0;32m\033[1m"
|
||||
endColour="\033[0m\e[0m"
|
||||
redColour="\e[0;31m\033[1m"
|
||||
blueColour="\e[0;34m\033[1m"
|
||||
yellowColour="\e[0;33m\033[1m"
|
||||
purpleColour="\e[0;35m\033[1m"
|
||||
turquoiseColour="\e[0;36m\033[1m"
|
||||
grayColour="\e[0;37m\033[1m"
|
||||
|
||||
space=$(df / | awk 'NR==2 {print $5}' | tr -d '%')
|
||||
notification="${redColour}[!] Espacio superior a 85%{endColour} Eliminar archivos YA!"
|
||||
|
||||
if [ $space -ge 85 ]; then
|
||||
echo -e "\n$notification"
|
||||
exit 1
|
||||
elif [ $space -ge 70 ]; then
|
||||
echo -e "\n${blueColour} Poco espacio \n tienes:${purpleColour}$(( 100 - $space))%${endColour}${blueColour} de espacio libre ${endColour}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n ${greenColour}[+] Vas bien de espacio \n tienes $(( 100 - $space))% de espacio libre ${endColour}"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Loading…
x
Reference in New Issue
Block a user