当前位置:网站首页>Shell executes SQL to send emails
Shell executes SQL to send emails
2022-08-01 07:29:00 【Generation of yuan pei】
#!/bin/bashCUR_DIR=$(cd "$(dirname "${BASH_SOURCE-$0}")";pwd)exec 1>>$CUR_DIR"/log/test.log"exec 2>>$CUR_DIR"/log/test.log.wf".~/.bashrc# The script is automatically executed on the 1st of every month# first day of the monthnowdate=`date +%Y%m01`# First day of last monthsyFirstDt=`date -d"$nowdate last month" +%Y%m%d`#last day of last monthssyLastDt=`date -d"$syFirstDt last day" +%Y%m%d`# Last day of last monthsyLastDt=`date -d "$nowdate last day" +%Y%m%d`# last month monthsy=`date -d "$nowdate last day" +%Y%m`# Execute time recordcurrent=`date "+%Y-%m-%d %H:%M:%S"`#timeStamp=`date -d "$current" +%s`echo '[run time]' $current#Convert current to timestamp, accurate to milliseconds#currentTimeStamp=$((timeStamp*1000+`date "+%N"`/1000000))sql="select..."echo '[sql]' $sqldata=`echo -e ${sql} |testdb -t -A`echo $dataret=`echo -e $data |awk -F '|' '{print $4}' `# send emailtitle="${sy} execution result is"content="$title(${ret})"echo $content | mail -s "${title}" [email protected] [email protected] '*** shell done ***'边栏推荐
- "By sharing" northwestern university life service | | bytes a second interview on three sides by HR
- 特殊的日子,值得纪念
- 关于App不同方式更新的测试点归纳
- 微信小程序请求封装
- 搜索框字符自动补全
- NIO programming
- Flink SQL - client, how to deal with the source side and to increase the target, the SQL - client including mapping table and the JOB such as
- 旋度(7)连接失败localhost8080;连接拒绝了
- rhcsa 第三次
- 【ASWC Arxml结构分解】-7-Explicit(显式)和Implicit(隐式) Sender-Receiver communication描述差异
猜你喜欢
随机推荐
Centos install php7.4, build hyperf, forward RDS
Chapters 6 and 7 of Huawei Deep Learning Course
22 Grab the Seat 1 C.Grab the Seat (Geometry + Violence)
VSCode插件推荐(Rust环境)
支付宝如何生成及配置公钥证书
配置我的kitty
POJ1251丛林之路题解
pytest interface automation testing framework | skip test classes
22牛客多校1 C.Grab the Seat (几何 + 暴力)
Explosive 30,000 words, the hardest core丨Mysql knowledge system, complete collection of commands [recommended collection]
C语言学习概览(二)
pytest接口自动化测试框架 | 单个/多个参数
国内外最顶级的8大plm项目管理系统
【HDLBits 刷题】Circuits(1)Combinational Logic
Practical training Navicat Chinese and English mode switching
金山打字通 官网 下载
我说过无数遍了:从来没有一种技术是为灵活组合这个目标而设计的
pytest接口自动化测试框架 | 跳过测试类
C语言学习概览(一)
云原生FAQ









