entrypoint.sh 696 Bytes
Newer Older
wangkaixiong's avatar
init  
wangkaixiong committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

# 启动脚本 - 自动执行 DCU 监控

# 检查 YAML 文件是否存在,不存在则创建默认配置
if [ ! -f "$YAML_PATH" ]; then
    echo "创建默认 YAML 配置文件..."
    cat > "$YAML_PATH" << EOF
targets:
  - http://10.20.100.13:16081/CollectDeviceMetrics
  - http://10.20.100.12:16081/CollectDeviceMetrics
EOF
    echo "默认配置文件创建完成"
fi

# 检查数据库目录是否存在
mkdir -p "$(dirname "$DB_PATH")"

# 启动监控脚本
echo "启动 DCU 监控服务..."

# 方法1:直接运行(适合调试)
python /app/new_ds_mon.py

# 方法2:使用 gunicorn(适合生产环境)
# gunicorn -w 1 -b 0.0.0.0:7860 --chdir /app new_ds_mon:app