微信报警脚本

 1 #!/bin/bash 2 #==================================================== 3 # Author: VizierBi 4 # Create Date: 2018-10-19 5 # Description:微信监控报警脚本  6 #==================================================== 7 CropID=wwaebf94b1310467a9 8 Secret=W6ahrPd1vg-M2I1CbXa9MYhRW_Vp10NNmOQNov2ELvY 9 GURL="https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$CropID&corpsecret=$Secret"10 Gtoken=$(/usr/bin/curl -s -G $GURL | awk -F" ‘{print $10}‘)11 PURL="https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$Gtoken"12 13 function body(){14 local int AppID=100000215 local UserID=$116 local PartyID=117 local Msg=$(echo "$@" | cut -d" " -f3-)18 printf {n19 printf t"touser": "‘"$User""",n"20 printf t"toparty": "‘"$PartyID""",n"21 printf t"msgtype": "text",n22 printf t"agentid": "‘" $AppID """,n"23 printf t"text": {n24 printf tt"content": "‘"$Msg"""n"25 printf t},n26 printf t"safe":"0"n27 printf }n28 }29 /usr/bin/curl --data-ascii "$(body $1 $2 $3)" $PURL

 

微信报警脚本

相关文章