企业微信通知脚本

任意目录创建weixin.sh文件,更换webHookUrl
设置执行权限:chmod u+x weixin.sh

#!/bin/bash
content=${
    
    @:1}
content=${
    
    content//\ /}
content=${
    
    content//\"/}
date=$(date +%Y-%m-%d)
time=$(date "+%H:%M:%S")
content="**微信通知**
    >Time:$date.$time
    >Info:$content
"
webHookUrl="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxx"
content='{"msgtype": "markdown","markdown": {"content": "'$content'","mentioned_list":"@all"},}'
curl --data-ascii "$content" $webHookUrl
echo "over!"

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/m0_46803792/article/details/129030871