I need help!! disk free space script

i want to write a shell script,when disk uses is 90% then automatically send a email to distribution list (group member)......

I changed the title of the thread -it was useless to anybody wanting to answer questions.
PLEASE use informative titles - ones that describe your problem.

The df -h command displays usually in the fifth column percent of disk space used. Pipe that into awk, look for disk usage 90 or above, write that to a file.
If the file is larger than zero bytes (only because you found a problem will this be true), then email to somebody@someplace.com

df -h | awk 'int($5)>89' > tmpfile
if  [ -s tmpfile ] ; then
   mailx -s 'disk space problem' me@mycompany.com < tmpfile
fi

You will need to make changes to send it to multiple users - I leave that up to you.

1 Like