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