The following is a script that detects the size of the log file (catalina.out):
#!/bin/bash#author:chris Chan#written for Check catalina.outsize=$ (du-m catalina.out| awk ' {print $} ') echo The size of the catalina.out is: $sizeif [$size-gt 19000]then rm-rf catalina.out echo "Warning, the catalina.out size of the test environment CMS has exceeded 18. 5G, has been deleted. " | Mail-s "Warning" [Email protected]else Exitfi
New Point of knowledge!
The way to send e-mail with the shell is simple, in the following format:
echo "Mail Content" |mail-s "Mail Header" Destination email address
But sometimes it can be an error, such as this phenomenon:
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/8D/8F/wKioL1ihmEGwpPu-AAB9Nb9SX2M248.png "title=" 1.png "alt=" Wkiol1ihmegwppu-aab9nb9sx2m248.png "/>
Encounter such phenomenon do not panic, in fact, the Mail has been sent successfully, but the reason that there will be such an error, because the current mail service does not support IPv6, then we first #vim/etc/postfix/main.cf, the inside of the inet_ protocols = All modified to Inet_protocols = IPv4, then #/etc/init.d/postfix restart, just fine.
Effect
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/8D/91/wKiom1ihmb6RuzTnAACUCXUvFqw821.png "title=" 1.png "alt=" Wkiom1ihmb6ruztnaacucxuvfqw821.png "/>
But be careful! This method to send 163 of the mailbox is possible, send QQ mailbox will be transferred by default to junk mail, need to manually trust.
This article is from "Life is waiting for Gordo" blog, please make sure to keep this source http://chenx1242.blog.51cto.com/10430133/1897416
How Linux comes with sending mail