检查进程如果不存在,则通过企业微信机器人发送信息到企业微信群
#!/bin/bash
pid=`ps -ef|grep 进程关键字|grep -v grep|awk '{print $2}'`
echo "PID is: $pid"
if [[ $pid -eq 0 ]];then
echo $pid
/usr/bin/curl '企业微信机器人webhook地址' \
-H 'Content-Type: application/json' \
-d '
{
"msgtype": "text",
"text": {
"content": "需要发送到企业微信群的信息",
"mentioned_list":["@all"]
}
}'
fi