这个发微信的脚本是之前领导给的,只能群发,可是若是用户分组的话,得去企业微信号里再建个应用,这样就会有2个cropid和secret,能够写个文件,去文件里取cropid和secretapi
#cat sendWeChat.shbash
#!/bin/bash CropID=wx3f2412099b302562 Secret=rJjcnyardWkvRZC7JRdBhtdbPcsfpd0gpaIJ8gWBrrZlhtjJFqYfKo1VtTB1WlHc GURL="https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$CropID&corpsecret=$Secret" Gtoken=$(/usr/bin/curl -s -G $GURL | awk -F\" '{print $4}') PURL="https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$Gtoken" #/usr/bin/curl --data-ascii "$(body $1 $2 $3)" $PURL #/usr/bin/curl --data-ascii '{ "touser": "@all", "toparty": " @all ","msgtype": "text","agentid": "1","text": {"content": "zabbix"},"safe":"0"}' $PURL agentid=$1 Content=$3 /usr/bin/curl --data-ascii "{ \"touser\": \"@all\", \"toparty\": \" @all \",\"msgtype\": \"text\",\"agentid\": \"${agentid}\",\"text\": {\"content\": \"$Content\"},\"safe\":\"0\"}" $PURL
、微信