17 lines
542 B
Bash
Executable File
17 lines
542 B
Bash
Executable File
#!/bin/bash
|
||
# 飞书告警(用 send_message,不需 webhook)
|
||
# 用法: feishu-alert.sh "消息内容"
|
||
|
||
MESSAGE="$1"
|
||
[ -z "$MESSAGE" ] && exit 1
|
||
|
||
# 用 hermes 自带的 send_message (chat_id 从 .env 拿 HOME_CHANNEL)
|
||
HOME_CHAT=$(grep "^FEISHU_HOME_CHANNEL=" /home/muc/.hermes/.env 2>/dev/null | cut -d= -f2 | sed 's/"//g')
|
||
[ -z "$HOME_CHAT" ] && {
|
||
echo "WARN: FEISHU_HOME_CHANNEL 未配置" >&2
|
||
exit 1
|
||
}
|
||
|
||
# 用 hermes 发送
|
||
timeout 30 hermes send message --platform feishu --chat-id "$HOME_CHAT" --content "$MESSAGE" 2>&1 | tail -1
|