home dir checking

Hi,

I want suggestion about user home directories, checking. how i could calculate this. I have 200 Users.

if home-dir-of-user1 > 250 MB -> print "OK"

fi

if home-dir-of-user1 > 500 MB > Print "Warning"

fi

if home-dir-of-user1 > 1000 MB > Print "Critical"

fi

Thanks,
Bash

Maybe have a look into quota.

What have you tried so far? While I agree on using quota, if you want to simply learn different commands, etc. you could expound on the following butchery...

awk -F ":" '/\/home/{print $6}' /etc/passwd|\

grep "^/home/" |\

while read dirs
do du -ch $dirs |\
awk '/total/{print x};{x=$0}'|\
grep "^[0-9]"|\
awk -F "K|M|G" '{print $1,$2}'

done

Hi,

Thanks for your input but i am using this

username i am calculting from another loop

bb1=`sudo du -s /home/${userame} | cut -f 1`

My objective is that, my script will check folder size if its

its euqal or less than 250MB then show "OK"

if its over 250MB and less than 500MB then show "WARNING"

if its over 500MB and less then 1GB then show "CRITICAL"

i dont understand what command should i use as i told above, and i how to do i store each user with in condition so it can generate good output as i describe above.

Thanks
Bash

Just use dispus and call it a day

Unix Review > Shell Corner: Displaying Disk Space Usage with dispus