treds
April 20, 2015, 8:27am
1
Hi
I have a volume that i want to run a daily check on to find out disk usage, and email me the results.
I have got as far as checking the size and email status. But cant seem to get the file size included into the email.
#!/bin/bash
cd /gpfs/TIER2/TAG_PRIMARY_ARCHIVE
du -sh
echo "Exit status was: $?" | mail -s "Archive Check finished" xxxxx@tagworldwide.com
Any help appreciated
Regards
Treds
RudiC
April 20, 2015, 11:30am
2
mail sends its stdin to the recipients. Your above mail 's stdin is piped from the echo statement. Try to combine du 's and echo 's outputs into the pipe...
size=`du -sh`
echo "status=$?
size=$size" |
mail ...
I think:
#!/bin/bash
cd /gpfs/TIER2/TAG_PRIMARY_ARCHIVE
( du -sh; echo "Exit status was: $?" ) |
mail -s "Archive Check finished" xxxxx@tagworldwide.com
is closer to what treds requested.
treds
April 21, 2015, 6:20am
5
thanks for all the responses