当前位置:网站首页>Mail monitoring cloud script execution progress
Mail monitoring cloud script execution progress
2022-06-25 19:09:00 【Daiyuanpei】

#!/bin/sh
# Monitoring cloud pay-data-load Script execution progress Old scripts use obsolete
current_path=$(cd "$(dirname $0)"; pwd)
data_path="$current_path/time/"
file_input=$current_path/file_input
html_file=$current_path/pay_data_load.html
if [ -f "$html_file" ];then
rm $html_file
fi
#if [ -f "$file_input" ];then
#rm $file_input
#fi
function get_all_time_data(){
# Create source data file
touch $file_input
echo "file_name input_time" > $file_input
echo "file " `cat $data_path/data.time` >> $file_input
echo "pre_file " `cat $data_path/pre-data.time` >> $file_input
# Judge pre_file Whether the date is today
today=`date +'%Y%m%d'`
pre_data_time=`cat $data_path/pre-data.time`
if [[ "$today" != "$pre_data_time" ]]; then
echo "FATAL: pre-data-file time is $pre_data_time,today data($today) is not load" >> "$current_path/log/pay-data-load.log.wf"
fi
}
td_str=''
function htmlTpl(){
DATE=`date +%Y-%m-%d`
SUBJECT=" Cloud data import progress "$DATE
HTML=`cat <<EOF
From: mailbot_yun <[email protected]>
To: [email protected]
Subject: $SUBJECT
Content-Type: text/html
EOF`
echo "$HTML" > $html_file
echo -e "<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>" >> $html_file
}
function create_style(){
style="<style type='text/css'>
*{
font-family: Helvetica, Arial, sans-serif;
font-size: 12px;
}
table {
border-collapse: collapse;
}
th, td {
border: 1px solid black;
padding: 10px;
}
th {
text-align: center;
}
tr:nth-child(2) {
background-color: #E4DFEC
}
tr td {
width: 120px;
padding: 8;
}
</style>
</head>"
echo -e $style >> $html_file
}
function create_table_head(){
echo -e "<table border='1px solid black' cellspacing='0'>\n" >> $html_file
}
function create_html_end(){
echo -e "</body>\n</html>" >> $html_file
}
# establish tr
function create_tr(){
create_row_value "$1"
echo -e "<tr>$td_str</tr>" >> $html_file
}
function create_row_value(){
td_str=`echo $1 \
| awk -F ' ' '
{
now=strftime("%Y%m%d")
day=strftime("%Y%m%d",systime()-3600*24*7)
input_content=$2
if ($2~/[0-9]/ && $3~/[0-9]/){
if ($2<=day){
input_content=$2"( It has not been updated for more than a week , Please pay attention to )"
}
}
print "<td>"$1"</td>","<td>"input_content"</td>"
}'`
}
# Create every td
function create_td(){
td_str=`echo $1 | awk 'BEGIN{FS=" "}''{i=1; while(i<=NF) {print "<td>"$i"</td>";i++}}'`
}
# establish table title
function create_table_title(){
echo -e "<tr><th colspan='2'> Data import progress </th></tr>" >> $html_file
}
# Create mail html Text
function create_html(){
htmlTpl
create_style
create_table_head
create_table_title
while read line;do
create_tr "$line"
done < $file_input
create_html_end
}
function send_mail(){
cat $html_file | /usr/sbin/sendmail -t
}
# entrance
function main(){
get_all_time_data
create_html
send_mail
}
main
if [ -f "$html_file" ];then
rm $html_file
fi
if [ -f "$file_input" ];then
rm $file_input
fi边栏推荐
- Analysis on market scale and supply of China's needle coke industry in 2020 [figure]
- Network security detection and prevention exercises (III)
- Connecting PHP to MySQL instances in the lamp environment of alicloud's liunx system
- Overview and trend analysis of China's foreign direct investment industry in 2020 [figure]
- 网络安全检测与防范 测试题(五)
- mysql my. Understanding CNF depends on configuration
- ECS 7-day practical training camp (Advanced route) -- day04 -- build a portal using ECs and polardb
- 请问同花顺开户安全吗?
- Error record: preg_ match(): Compilation failed: range out of order in character class at offset 13
- How to quickly close port 8080
猜你喜欢
![[today in history] June 25: the father of notebook was born; Windows 98 release; First commercial use of generic product code](/img/ef/a26127284fe57ac049a4313d89cf97.png)
[today in history] June 25: the father of notebook was born; Windows 98 release; First commercial use of generic product code

云上弹性高性能计算,支持生命科学产业高速发展、降本增效

PHP Chinese regular
![Analysis of global tea production, consumption and import and export trade: China's tea production ranks first in the world [figure]](/img/16/ab5056dd26cf7b1a761a92eea46e54.jpg)
Analysis of global tea production, consumption and import and export trade: China's tea production ranks first in the world [figure]
![Analysis on the development trend of China's intense pulsed light equipment industry in 2021: the market scale is growing, and the proportion of imported brands is large [figure]](/img/15/4477a850044136bb4b1ee92ab6df45.jpg)
Analysis on the development trend of China's intense pulsed light equipment industry in 2021: the market scale is growing, and the proportion of imported brands is large [figure]

初探Oracle全栈虚拟机---GraalVM

Detailed explanation of oauth2 - Introduction (I)
![Current situation of China's hydraulic cylinder industry in 2020 (with application fields, policies and regulations, supply and demand status and enterprise pattern) [figure]](/img/2e/439b5dce9634d4015430c9cf06c5de.jpg)
Current situation of China's hydraulic cylinder industry in 2020 (with application fields, policies and regulations, supply and demand status and enterprise pattern) [figure]

QQ机器人疫情查询/疫情关注等【最新beta2版本】

Kotlin compose terminate todo project Click to edit and modify todo
随机推荐
SVN介绍及使用总结
QQ机器人疫情查询/疫情关注等【最新beta2版本】
Detailed explanation of oauth2 - Introduction (I)
TCP/IP 测试题(五)
Kotlin compose terminate todo project Click to edit and modify todo
TCP/IP 测试题(三)
两轮市场红海,利尔达芯智行如何乘风破浪?
QQ机器人官方插件加载配置方法【beta2版本】
Favorite PHP debugging methods
Elastic high-performance computing on the cloud supports the rapid development of the life science industry, reducing costs and increasing efficiency
Does GoogleSEO need to change the friend chain? (e6zzseo)
On Oracle full stack virtual machine -- graalvm
揭秘GES超大规模图计算引擎HyG:图切分
QQ robot: self forbidden words management of group members [latest beta2 version]
Analysis on development status and development suggestions of e-commerce industry in Xinjiang in 2020 [figure]
MySQL prompt performance_ Schema missing table
Solidity date tool
mysql my. Understanding CNF depends on configuration
solidity获取季度时间
Tcp/ip test questions (III)