Centos7 sending Linux system status via mail timing

Source: Internet
Author: User

#vim/etc/mail.rc

Add the following two lines at the end of the document

Set from=***@163.com smtp=smtp.163.com

Set smtp-auth-user=***@163.com smtp-auth-password=*** Smtp-auth=login

The following line of command tests can be added to send mail to * * * @qq. com

#cat/etc/passwd | Mail-s "System statue" [email protected]

#vim/root/space.sh

Mail-s "System Status" [email protected] << EOF

' Echo '-----------MySQL data space use-----------"

Du-h/mydata

echo "-----------Home data space use-----------"

Du-h/home-d 1

echo "-----------CPU load-----------"

Uptime

echo "----------Who's login----------"

W.H.O.

echo "----------Mem swap-----------"

Free-h '

Eof

Preparing scheduled execution tasks

#vim/etc/crontab

Add the following line at the end of the document, one at a time per day

0 1 * * * Root sh/root/spaceuse.sh

The effect is as follows:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6F/2D/wKiom1WTpNODUZyrAAM1CPRJL-w420.jpg "title=" Qq20150701162710.jpg "alt=" Wkiom1wtpnoduzyraam1cprjl-w420.jpg "/>

This article is from the "Linux" blog, so be sure to keep this source http://maolinux.blog.51cto.com/2131264/1669804

Centos7 sending Linux system status via mail timing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.