0
点赞
收藏
分享

微信扫一扫

linux下用nutt发送邮件

小禹说财 2022-02-24 阅读 51

#!/bin/sh

#功能描述:通过邮件将数据按不同人员发不同地区数据


body='邮件内容部分'

#reportPath="/home/hotel/xxx/data/thailandreport/"
reportPath=`pwd -P`
echo "reportPath:"$reportPath

#download txt2xls function,local则无需download
hdfs dfs -get hdfs://ns/home/hotel/xxx/script/xxx/txt2xls.py $reportPath/txt2xls.py

#countryid
arr1=(2 3 4)
#mailaddress
arr2=("ye_aaa@xxx.com" "mu_bbb@xxx.com" "chen_ccc@xxx.com")

#sql
esql="
          select
             *
          from dw_xxxxdb.warnprice
          where 1=1
         "
lsql=""
lmail=""
for ((i=0;i<${#arr1[@]};i++))
do
    lsql=$esql" and country = "${arr1[$i]}
    echo $lsql
    
    lmail=${arr2[$i]}
    echo $lmial
    
    hive -e "$lsql"> $reportPath/report.txt
    python2.7 $reportPath/txt2xls.py $reportPath/report.txt $reportPath/report.xls
    echo $body | cat | mutt -s "风控拦截test" -e "my_hdr from:xxxxx组<algorithmxxx@xxxxx.com>" $lmail -c ye_aaa@Ctrip.com -a $reportPath/report.xls

done

举报

相关推荐

0 条评论