#!/bin/bash
source /etc/profile #需要导入环境变量,否则非原生命令执行不成功
Sendmail(){
smtp='mail.yx.com'
account='[email protected]'
password='123'
to='[email protected]'
subject=$1
content=$2
sendemail -f $account -t $to -s $smtp -u $subject -o message-charset=utf8 -xu $account -xp $password -m $content -o tls=no }
res=`fs_cli -x "originate {absolute_codec_string=^^:PCMA,bridge_early_media=true,origination_caller_id_number=1007,origination_uuid=11035221997,origination_caller_id_number=11035221997,effective_caller_id_number=11035221997, effective_caller_id_name=11035221997}user/1007 11_Mogu_551113812266322" 2>&1`
echo "`date`, Mogu, $res" >>/usr/local/fs/scripts/fs.log 2>&1
if [ ${res: 0: 3} != '+OK' ];then
#echo $res
subject='Dial failed from Mogu'
Sendmail "$subject" "${res: 1: 10000}"
fi
crontab -l 内容:
2 8 * * * /bin/bash /usr/local/fs/scripts/mon_dial_mogu.sh
4 8 * * * /bin/bash /usr/local/fs/scripts/mon_dial_beishang.sh