22 Oct
2019
22 Oct
'19
11:51 p.m.
On Tue, 22 Oct 2019, Plutocrat wrote:
I recently wrote a script to check disk space every week and email me an alert if there was less than 5G.
Every week? Unless you're using a telephone modem, an out of control mail loop or being the victim of a joe-job can consume 5Gb of space in no time. I recommend a more frequent interval if you're in the single digit Gb's.
MAILSPACE=$( df -h | grep "/dev/sdd" | awk '{ print $4 }' | sed 's/G//g' ) if [ "$MAILSPACE" -lt "5" ] ; then
If free space dips below 1Gb, (e.g. 900M), this will either fail or do the opposite of what you want. Maybe
MAILSPACE=$( df -k | awk '/\/dev\/sdd/{print int($4/(1024*1024)}' )
Joseph Tam jtam.home@gmail.com