The server automatically sends an email to monitor the freeswitch process.

Source: Internet
Author: User
Tags freeswitch

The server automatically sends an email to monitor the freeswitch process.

Vim/etc/mail. rc adds set from = ******* @ 163.com smtp = smtp: // smtp.163.com: 25 set smtp-auth-user = ****** @ 163.com smtp-auth-password = ****** smtp-auth = loginvim check. sh #! /Bin/bashsource. bash_profilepip = 101.251.251.92ip = '/sbin/ifconfig eth0 | grep "inet addr" | awk' {print $2} '| awk-F: '{print $2} ''I = 'ps-ef | grep freeswitch | grep-v grep | wc-l 'date = 'date' cpu = 'top-B-n 1 | grep Cpu | awk '{print $2}' | cut-f 1-d "%" 'Ping = 'Ping-c 3 $ pip | awk' NR = 7 {print $4} ''if [$ ping-eq 0] thentext2 =" $ pip status GRASHED "elsetext2 =" $ pip status READY "fiif [$ I-lt 1] thentext = 'freeswitch is low' echo "Server: "$ ip $ '\ n' $ date $' \ N'" CPU used: "$ cpu $ '\ N'" $ text2 "$' \ N'" $ text "| mail-s" $ ip Abnormal "-a/home/freeswitch/log/freeswitch. log ***** @ qq.com # else # text = 'freeswitch is running... '# echo "Server:" $ ip $' \ n' $ date $ '\ N' "CPU used: "$ cpu $ '\ N'" $ text2 "$' \ N'" $ text "| mail-s" $ ip Normal "****** @ qq. comfi
Set to every day, and automatically execute scripts to send emails every hour
crontab -e0 8-23 * * * /root/check.sh

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.