当前位置:网站首页>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 ***'边栏推荐
- Srping bean in the life cycle
- MATLAB program design and application of MATLAB 2.5
- Generate pictures based on the content of the specified area and share them with a summary
- 自制一款远程控制软件——VeryControl
- Chapters 6 and 7 of Huawei Deep Learning Course
- 电磁兼容简明教程(6)测试项目
- zip打包目录所有文件(含隐藏文件/夹)
- JVM: Runtime Data Area - PC Register (Program Counter)
- 零代码网站开发利器:WordPress
- POJ2031空间站题解
猜你喜欢
随机推荐
LevelSequence源码分析
阿里三面:MQ 消息丢失、重复、积压问题,该如何解决?
套接字选项
自制一款远程控制软件——VeryControl
Introduction to the basic principles, implementation and problem solving of crawler
2022杭电中超杯(1)个人题解
LeetCode 415:字符串相加
国内外最顶级的8大plm项目管理系统
pytest接口自动化测试框架 | 集成Allure测试报告
POJ2031空间站题解
rhcsa 第四天
【一句话攻略】彻底理解JS中的回调(Callback)函数
聊一聊ICMP协议以及ping的过程
旋度(7)连接失败localhost8080;连接拒绝了
根据指定区域内容生成图片并进行分享总结
Golang:go获取url和表单属性值
数据分析6
22 Grab the Seat 1 C.Grab the Seat (Geometry + Violence)
最小生成树
Dart exception details









