Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mail me the df -k output 2

Status
Not open for further replies.

sirrom

Technical User
Jul 11, 2001
80
0
0
GB
I have wriiten a small script that does similar to a df -k called dfk
I have placed it on to several of my clients servers.
What do I need to do to get the output of the dfk mailed to me instead of me logging on and collecting say every 5 hours.
 
Well, you could do this:

run your 'dfk' script and output it to a file, say

dfk > dfkresults.txt

then, add to your script,
-------------snip---------------------
mail -s &quot;dfk results&quot; youremail@address.com < dfkresults.txt
-------------snip---------------------
that should work :)

hope this helps
 
Why not just pipe it directly to your email?

df -k |mail youremail@yourhost.com

That should be all you need.
 
Sirrom,
Would you have your df -k script handy, the one you wrote, I actually worte something like that but having problems with mine
 
clear
echo &quot; Checking File Systems&quot;
echo
echo &quot;Mount Total Used Free Used% Test&quot;
echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
df -k |grep /| awk '{$2 = $2 /1000; $3 = $3 /1000 ; {if ($5>86) $9 = &quot;warning&quot;
}; $4 = $4 /1000; printf &quot;%-15s &quot; &quot;%8.1f Mb &quot; &quot;%8.1f Mb&quot;
&quot;%8.1f Mb\t%5s%10s\n&quot; ,$6, $2, $3,$4,$5,$9}'|sort
echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
echo
echo &quot;Check file systems with warning&quot;
echo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top