Hello. First time here. Site looks really cool, with lots of great info. However, I need some scripting help:
In a nutshell:
I am in need to create a script that queries how large a partition is and when it hits a certain percentage (say 90%) it will execute another script that tars up certain files (or they could just be part of the same script). I would create a cronjob that runs this script once a day.
I have the script that tars up the files I need, sets permissions, etc. (btw, the files in question are audit logs). I just need the part that runs something like a df -h and takes the use percentage of the /var partition in that query and if that percentage is greater than/ equal to 90%, it kicks off the tar script.
Here is a sniplet of the df -h with just the /var partition shown:
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 7.5G 331M 6.8G 5% /var
So, when the cronjob sees that the Use% is >= 90%, it would kick off the tar script...if not above 90%, it closes.