MSG=`df - Ik|awk '$6~/Monthly$/{gsub("%"," ");
if ($5>20){print "FS:Monthly filesystem is "$5"%"}}'`
if [ "$MSG" != "" ]
then echo $MSG | mail [email protected]
fi
I'm only casually acquainted with awk, but I can certainly see what's going on here.
At the highest level, you are storing the output of a command into an environment variable named MSG. The back quotes (`` ) run the command and return the text.
But I suspect you have not quite correctly copied the command that pipes into awk, that is, "
df - Ik". The closest sensible command would be "
df -ik", which shows how many inodes, or directory entries, are used up. The
$5 part of the awk print command would grab the fifth output column from df, which is the percentage.
As for the change, I think the previous answer was correct, just change the directory.
BTW, did you really intend to give your cell phone number to the world?