代码如下 我这个是用命令生成了一个图片
然后调用企业微信群聊机器人发送图片
#/bin/bash wx_web(){ cat > sendweb.sh<< EOF curl -X POST -H "Content-Type: application/json" -d @- "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=0b0ea4cc-xx-xx-xxx-xx"<<CURL_DATA { "msgtype": "image", "image": { "base64": "$DATA", "md5": "$MD5" } } CURL_DATA EOF sh sendweb.sh && rm -rf sendweb.sh } time=$(date "+%Y%m%d") ansible ‘211‘ -m shell -a "ls -l /home/newiuplog/upload_*$time*" >dns.txt sleep 1 ansible ‘211‘ -m shell -a "cat /home/newiuplog/upload_*$time*.txt" >>dns.txt sleep 1 enscript -B -p - dns.txt | ps2pdf - | convert -density 300 - dns-$time.jpg MD5=`cat dns-$time.jpg | md5sum|awk ‘{print $1}‘` DATA=`cat dns-$time.jpg | base64` wx_web