Linux mail发送邮件

发送前一天的监控日志
#!/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

 

posted @ 2016-06-20 17:50  贺呵呵  阅读(439)  评论(0编辑  收藏  举报