2015-11-24
yum -y install postfix mutt vim /etc/postfix/main.cf inet_protocols = ipv4 mydomain = pateo.com.cn service postfix restart vim /etc/mail.rc set smtp=127.0.0.1 set from=root@ivi-prod-sdb-srv1 vim /etc/Muttrc set from=root@ivi-prod-sdb-srv1 set sendmail="/usr/sbin/sendmail.postfix" set use_from=yes set realname="系统" set editor="vim" cd /data/home/cenliang/shell/ && vim mail_body.txt Dear all, Attached is ipda_active report. Best Regards! cd /data/home/cenliang/shell/ && vim ipda_active.sh #!/bin/bash mysql -uroot -ppro#pateo -e "select distinct(c.vin) as '虚拟vin', upper(v.vhl_vin) as '真实vin', v.pdsn , c.create_time as '激活时间' , a.sw_reference as '软件版本号', u.login_name as '激活手机号' from tas.contract c , bdc.atb_profile a, tas.vhl_profile v left join tas.vhl_user u on v.customer_id = u.id where c.contract_status = '3' and c.record_status='1' and c.vin = v.vin and v.vhl_brand_id = '1' and c.vin = a.vin;" >ipda_active0.xls
iconv -futf8 -tgb2312 -oipda_active.xls ipda_active0.xls
sleep 5m
mutt chunminghu@pateo.com.cn -c leocen@pateo.com.cn -s "`date +%Y-%m-%d` ipda_active" -a /data/home/cenliang/shell/ipda_active.xls < /data/home/cenliang/shell/mail_body.txt