-
1、企业微信添加机器人,记住接口机器人webhook地址
企业微信APP——选择群聊——点击右上角——选择群机器人(创建)
image.png
-
2、创建文件tixing.sh:
touch tixing.sh
-
3、编辑文件内容
vim tixing.sh
curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=373befxxxxxxxxxxxe3' \
-H 'Content-Type: application/json' \
-d '
{
"msgtype": "text",
"text": {
"content": "[太阳]各位小伙伴,健康申报天天有约![呲牙]\n [爱心]请点击以下链接\nhttps://www.wjx.cn/jq/55555555555357.aspx\n[嘿哈][嘿哈]",
"mentioned_list":["@all"]
}
}'

- 4、添加执行权限
chmod +x tixing.sh
- 5、执行脚本文件,看机器人是否发送群消息,能收到群消息即表示成功了
./tixing.sh
- 6、添加定时任务
crontab -e
0 10 * * 1,3,5,7 /root/mile/tixing.sh
#每周一、三、五、七上午10点执行tixing.sh


- 7、查看定时任务是否添加成功,能显示则表示成功了
crontab -l
网友评论