Files
task-supervisor/scripts/news_broadcast.sh
seahi 1bac55cf54
All checks were successful
continuous-integration/drone/push Build is passing
修改新闻脚本的日志格式为json
2025-04-17 21:53:45 +08:00

22 lines
403 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
echo "新闻播报服务启动中..."
while true
do
# 获取当前时间
current_time=$(date '+%Y-%m-%d %H:%M:%S')
# 构建JSON格式的日志
json_log=$(cat << EOF
{
"service": "新闻播报",
"timestamp": "$current_time",
"headline": "今日科技新闻新型AI技术发布"
}
EOF
)
# 输出JSON格式的日志
echo "$json_log"
sleep 5
done