shell脚本运维发送微信消息 您所在的位置:网站首页 Linux发送信息到微信 shell脚本运维发送微信消息

shell脚本运维发送微信消息

2024-03-27 20:56| 来源: 网络整理| 查看: 265

#!/bin/bash # 监控ElasticSearch服务器运行状态,若服务器停止运行则发送微信消息通知

# 脚本及配置文件config.json运行位置 根据实际目录修改 cd /root/Desktop

# 系统信息 Date=`date +%Y-%m-%d` Date_time=`date "+%Y-%m-%d %H:%M:%S"` Host_name=`hostname` IP_addr=`ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"`

# 微信token获取接口参数 Grant_type="client_credential"

# 微信平台申请的APPID Appid="*******************************"

# 微信平台申请的APP密码 Secret="****************************************"

# 微信平台发送消息token获取的地址,需要在微信平台上设置ip白名单才能获取 GURL="https://api.weixin.qq.com/cgi-bin/token?grant_type=$Grant_type&appid=$Appid&secret=$Secret"

# 获取微信token # 获取微信访问token # 返回的token结果json数据为 # { #    "access_token": "40_MYUor



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有