您的位置:首页 > 运维架构 > Linux

Linux mail发送邮件

2016-06-20 17:50 429 查看
发送前一天的监控日志
#!/bin/bash
source /etc/profile
time=`date -d '-1 day' "+%Y%m%d"`
#判断服务是否已经启动
ser=`/usr/bin/pgrep sendmail`
if [ "$ser" != "" ]
then
echo "the service is running"
else
/etc/init.d/sendmail start
fi

#要发送的文件
file=/home/wlycle_uniq/data/send_head_data$time.info
#收件人
array=(ex-hefeng600@pingan.com.cn aa@qq.com)
for i in ${array[@]};do
mail -s "玉衡短信发送内容定时跟踪" $i -r dbc@notice.com < $file
if [ $? != 0 ]; then
echo "step for mail is failed"
exit 0
fi
done
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: