当前位置:网站首页>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 ***'边栏推荐
- 并发编程13-JUC之CountDownLatch
- Practical training Navicat Chinese and English mode switching
- LeetCode240+312+394
- Case practice --- Resnet classic convolutional neural network (Mindspore)
- Shell执行SQL发邮件
- "By sharing" northwestern university life service | | bytes a second interview on three sides by HR
- Detailed explanation of the crawler framework Scrapy
- 支付宝如何生成及配置公钥证书
- Zero-code website development tool: WordPress
- Delphi MDI appliction 文档最大化显示、去掉最大化最小化等按钮
猜你喜欢
随机推荐
七夕来袭——属于程序员的浪漫
Golang:go获取url和表单属性值
日志导致线程Block的这些坑,你不得不防
研发过程中的文档管理与工具
How to use Photoshop to composite star trail photos, post-processing method of night sky star trail photos
旋度(7)连接失败localhost8080;连接拒绝了
Go 支持 OOP: 用 struct 代替 class
【ASWC Arxml结构分解】-7-Explicit(显式)和Implicit(隐式) Sender-Receiver communication描述差异
小程序更多的手势事件(左右滑动、放大缩小、双击、长按)
JSON 与 JS 对象的区别
GO错误处理方式
Vim简介
Practical training Navicat Chinese and English mode switching
LeetCode240+312+394
Chapter 9 of Huawei Deep Learning Course - Convolutional Neural Network and Case Practice
VoLTE基础学习系列 | 企业语音网简述
The socket option
05-SDRAM: Arbitration
JVM:运行时数据区-PC寄存器(程序计数器)
nodetype中值1、2、3分别代表什么意思









