bash;gutter:true;</p>
<h1>!bin/bash</h1>
<p>date_Now=$(date +%Y%m%d)
set -e
set -x
这里定义发送的消息艾特多个人,
atMobiles=xxxxxxxx
keyword="告警"</p>
<p>dintalkurl="https://oapi.dingtalk.com/robot/send?access_token=993fae78d36f623907ae2a0be5123a3be6a85dab7a19556ff32d6fcebfe54y7c"</p>
<p>cat /etc/ansible/domain_ssl/domain_ssl.txt | while read line
do
Type=<code>echo $line | awk '{print $1}'</code>
Name=<code>echo $line | awk '{print $2}'</code>
expiration=<code>echo $line | awk '{print $3}'</code>
time1=<code>date +%s -d "$expiration"</code>
time2=<code>date +%s -d "$date_Now"</code>
expiration_date=$(((time1-$time2)/86400))
if [ $expiration_date -le 45 ];then
msg="Type:$Type,Name:$Name,剩余有效天数:$expiration_date 天,过期时间:$expiration,请及时续费."
curl ${dintalkurl} \
-H 'Content-Type: application/json' \
-d '{"msgtype": "text",
"text": {
"content": "'"$msg"'"
},"at": {
"atMobiles": ['${atMobiles}']
}
}'</p>
<pre><code>else
continue
fi
</code></pre>
<p>done</p>
<pre><code>
;gutter:true;
cat domain_ssl.txt
Domain xxxxx.co.id 20240504
Domain xxxx.id 20240524
Domain xxxx.id 20221007
Domain xxx.id 20220923
Domain xxx.id 20220923
Domain xxxx.net 20221207
Domain xxxx.com 20220819
Hosting xxxxx.com 20220819
SSL xxxxx.com 20220825
Original: https://www.cnblogs.com/The-day-of-the-wind/p/16117428.html
Author: MlxgzZ
Title: 监控域名,证书过期时间
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/582065/
转载文章受原作者版权保护。转载请注明原作者出处!