Download scripts/entrypoint.sh from q1340/hindsight: direct link, hf CLI and curl.
- Browser
- Download file 621 Bytes
-
https://huggingface.co/spaces/q1340/hindsight/resolve/main/scripts/entrypoint.sh
- Command line
-
hf download hf://spaces/q1340/hindsight/scripts/entrypoint.sh
-
curl -L -o entrypoint.sh https://huggingface.co/spaces/q1340/hindsight/resolve/main/scripts/entrypoint.sh
621 Bytes
| set -euo pipefail | |
| # 启动 Hindsight | |
| /app/start-all.sh & | |
| HINDSIGHT_PID=$! | |
| # 等待健康 | |
| for i in $(seq 1 60); do | |
| if curl -sf http://localhost:7860/health > /dev/null 2>&1; then | |
| break | |
| fi | |
| sleep 5 | |
| done | |
| # 如果存在备份,直接在运行中的 PG 里恢复(不需要重启 Hindsight) | |
| if [ -n "${HF_TOKEN:-}" ]; then | |
| python3 /opt/backup/restore.py || true | |
| fi | |
| # 定期备份循环 | |
| while kill -0 "$HINDSIGHT_PID" 2>/dev/null; do | |
| sleep "${BACKUP_INTERVAL_SECONDS:-21600}" & | |
| wait $! || true | |
| [ -n "${HF_TOKEN:-}" ] && python3 /opt/backup/backup.py scheduled || true | |
| done |